about summary refs log tree commit diff
path: root/pkgs/by-name/go
diff options
context:
space:
mode:
authorPatrizio Bekerle <patrizio@bekerle.com>2024-05-07 14:03:31 +0200
committerPatrizio Bekerle <patrizio@bekerle.com>2024-05-07 14:03:50 +0200
commit286e12521862488664e4cd3c6002c4ec8294aa83 (patch)
treec6328af48493f64d0884ab0cd232f8e630ae5e66 /pkgs/by-name/go
parent2fd19c8be2551a61c1ddc3d9f86d748f4db94f00 (diff)
go-passbolt-cli: init at 0.3.1
Diffstat (limited to 'pkgs/by-name/go')
-rw-r--r--pkgs/by-name/go/go-passbolt-cli/package.nix52
1 files changed, 52 insertions, 0 deletions
diff --git a/pkgs/by-name/go/go-passbolt-cli/package.nix b/pkgs/by-name/go/go-passbolt-cli/package.nix
new file mode 100644
index 0000000000000..e774769ae45e0
--- /dev/null
+++ b/pkgs/by-name/go/go-passbolt-cli/package.nix
@@ -0,0 +1,52 @@
+{ buildGoModule, fetchFromGitHub, installShellFiles, lib, stdenv }:
+
+buildGoModule rec {
+  pname = "go-passbolt-cli";
+  version = "0.3.1";
+
+  src = fetchFromGitHub {
+    owner = "passbolt";
+    repo = "go-passbolt-cli";
+    rev = "v${version}";
+    hash = "sha256-I+niNUowKTFDMa7yOnRToMFPzO/CbnjXHJr5nAhhHcg=";
+  };
+
+  vendorHash = "sha256-XRHGq3Qeq7VWHzw5WWVv4x5orQu740lttGVreiu7qP4=";
+
+  ldflags = [
+    "-X=main.version=${version}"
+    "-X=main.commit=${src.rev}"
+    "-X=main.date=1970-01-01T00:00:00Z"
+  ];
+
+  subPackages = [ "." ];
+
+  nativeBuildInputs = [
+    installShellFiles
+  ];
+
+  installPhase = ''
+    runHook preInstall
+    install -D $GOPATH/bin/go-passbolt-cli $out/bin/passbolt
+    runHook postInstall
+  '';
+
+  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
+    installShellCompletion --cmd passbolt \
+      --bash <($out/bin/passbolt completion bash) \
+      --fish <($out/bin/passbolt completion fish) \
+      --zsh <($out/bin/passbolt completion zsh)
+
+    export tmpDir=$(mktemp -d)
+    cd $tmpDir && mkdir man && $out/bin/passbolt gendoc --type man && installManPage man/*
+  '';
+
+  meta = with lib; {
+    description = "CLI tool to interact with Passbolt, an open source password manager for teams";
+    homepage = "https://github.com/passbolt/go-passbolt-cli";
+    license = licenses.mit;
+    maintainers = with maintainers; [ pbek ];
+    mainProgram = "passbolt";
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}