about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/hasura/cli.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/hasura/cli.nix')
-rw-r--r--nixpkgs/pkgs/servers/hasura/cli.nix35
1 files changed, 35 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/hasura/cli.nix b/nixpkgs/pkgs/servers/hasura/cli.nix
new file mode 100644
index 000000000000..09e1a5fd95c1
--- /dev/null
+++ b/nixpkgs/pkgs/servers/hasura/cli.nix
@@ -0,0 +1,35 @@
+{ buildGoModule, hasura-graphql-engine }:
+
+buildGoModule rec {
+  pname = "hasura";
+  version = hasura-graphql-engine.version;
+
+  src = hasura-graphql-engine.src;
+  modRoot = "./cli";
+
+  subPackages = [ "cmd/hasura" ];
+
+  vendorHash = "sha256-S6xyevC/7dpn2Ana5mkROwIOvtQVPThoNEVKkXQmUGY=";
+
+  doCheck = false;
+
+  ldflags = [
+    "-X github.com/hasura/graphql-engine/cli/version.BuildVersion=${version}"
+    "-s"
+    "-w"
+  ];
+
+  postInstall = ''
+    mkdir -p $out/share/{bash-completion/completions,zsh/site-functions}
+
+    export HOME=$PWD
+    $out/bin/hasura completion bash > $out/share/bash-completion/completions/hasura
+    $out/bin/hasura completion zsh > $out/share/zsh/site-functions/_hasura
+  '';
+
+  meta = {
+    inherit (hasura-graphql-engine.meta) license homepage maintainers;
+    description = "Hasura GraphQL Engine CLI";
+    mainProgram = "hasura";
+  };
+}