nwg-dock: 0.4.1 -> 0.4.2 (#372381)
[NixPkgs.git] / pkgs / by-name / im / immudb / package.nix
blob76224b1f175883c918a052af06bbd1e1dbd39854
2   lib,
3   buildGoModule,
4   fetchFromGitHub,
5   fetchzip,
6   installShellFiles,
7 }:
9 let
10   webconsoleVersion = "1.0.18";
11   webconsoleDist = fetchzip {
12     url = "https://github.com/codenotary/immudb-webconsole/releases/download/v${webconsoleVersion}/immudb-webconsole.tar.gz";
13     sha256 = "sha256-4BhTK+gKO8HW1CelGa30THpfkqfqFthK+b7p9QWl4Pw=";
14   };
16 buildGoModule rec {
17   pname = "immudb";
18   version = "1.9.5";
20   src = fetchFromGitHub {
21     owner = "codenotary";
22     repo = pname;
23     rev = "v${version}";
24     sha256 = "sha256-XKioPk0Rv+I916OLInJEtOaDV9KcBMWSHmPOq2k3LTQ=";
25   };
27   postPatch = ''
28     EXPECTED_WEBCONSOLE_STRING='DEFAULT_WEBCONSOLE_VERSION=${webconsoleVersion}'
29     if ! grep -F "$EXPECTED_WEBCONSOLE_STRING" Makefile ; then
30       echo "Did not find $EXPECTED_WEBCONSOLE_STRING in Makefile. " \
31         "Our webconsole version may need bumping (or the Makefile may have changed)"
32       exit 3
33     fi
34   '';
36   preBuild = ''
37     mkdir -p webconsole/dist
38     cp -r ${webconsoleDist}/* ./webconsole/dist
39     go generate -tags webconsole ./webconsole
40   '';
42   vendorHash = "sha256-6DHmJrE+xkf8K38a8h1VSD33W6qj594Q5bJJXnfSW0Q=";
44   nativeBuildInputs = [ installShellFiles ];
46   tags = [ "webconsole" ];
48   ldflags = [ "-X github.com/codenotary/immudb/cmd/version.Version=${version}" ];
50   subPackages = [
51     "cmd/immudb"
52     "cmd/immuclient"
53     "cmd/immuadmin"
54   ];
56   postInstall = ''
57     mkdir -p share/completions
58     for executable in immudb immuclient immuadmin; do
59       for shell in bash fish zsh; do
60         $out/bin/$executable completion $shell > share/completions/$executable.$shell
61         installShellCompletion share/completions/$executable.$shell
62       done
63     done
64   '';
66   meta = with lib; {
67     description = "Immutable database based on zero trust, SQL and Key-Value, tamperproof, data change history";
68     homepage = "https://github.com/codenotary/immudb";
69     license = licenses.asl20;
70     maintainers = with maintainers; [ dit7ya ];
71   };