diff --git a/pkgs/tools/security/gopass/default.nix b/pkgs/tools/security/gopass/default.nix index 275904122505..0c8553a18132 100644 --- a/pkgs/tools/security/gopass/default.nix +++ b/pkgs/tools/security/gopass/default.nix @@ -1,28 +1,39 @@ { lib, stdenv, - makeWrapper, + makeBinaryWrapper, buildGoModule, fetchFromGitHub, installShellFiles, - git, + gitMinimal, gnupg, xclip, wl-clipboard, passAlias ? false, apple-sdk_14, - testers, nix-update-script, - gopass, + versionCheckHook, }: -buildGoModule rec { +let + wrapperPath = lib.makeBinPath ( + [ + gitMinimal + gnupg + xclip + ] + ++ lib.optionals stdenv.hostPlatform.isLinux [ + wl-clipboard + ] + ); +in +buildGoModule (finalAttrs: { pname = "gopass"; version = "1.15.16"; nativeBuildInputs = [ installShellFiles - makeWrapper + makeBinaryWrapper ]; buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ @@ -33,7 +44,7 @@ buildGoModule rec { src = fetchFromGitHub { owner = "gopasspw"; repo = "gopass"; - rev = "v${version}"; + tag = "v${finalAttrs.version}"; hash = "sha256-oZeik172VBSxuO3DfD5t8cKPl3AYjlyEw5x4/7g9h6o="; }; @@ -44,19 +55,10 @@ buildGoModule rec { ldflags = [ "-s" "-w" - "-X main.version=${version}" - "-X main.commit=${src.rev}" + "-X main.version=${finalAttrs.version}" + "-X main.commit=${finalAttrs.src.rev}" ]; - wrapperPath = lib.makeBinPath ( - [ - git - gnupg - xclip - ] - ++ lib.optional stdenv.hostPlatform.isLinux wl-clipboard - ); - postInstall = '' installManPage gopass.1 installShellCompletion --cmd gopass \ @@ -73,25 +75,26 @@ buildGoModule rec { --prefix PATH : "${wrapperPath}" \ --set GOPASS_NO_REMINDER true ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgramArg = "--version"; + passthru = { inherit wrapperPath; - tests.version = testers.testVersion { - package = gopass; - }; - updateScript = nix-update-script { }; }; - meta = with lib; { + meta = { description = "Slightly more awesome Standard Unix Password Manager for Teams. Written in Go"; homepage = "https://www.gopass.pw/"; - license = licenses.mit; - maintainers = with maintainers; [ + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ rvolosatovs sikmir ]; - changelog = "https://github.com/gopasspw/gopass/blob/v${version}/CHANGELOG.md"; + changelog = "https://github.com/gopasspw/gopass/blob/v${finalAttrs.version}/CHANGELOG.md"; longDescription = '' gopass is a rewrite of the pass password manager in Go with the aim of @@ -104,4 +107,4 @@ buildGoModule rec { ''; mainProgram = "gopass"; }; -} +})