gopass: use `finalAttrs` pattern (#443383)

authored by

Pol Dellaiera and committed by
GitHub
6b934338 8acfb459

+30 -27
+30 -27
pkgs/tools/security/gopass/default.nix
··· 1 1 { 2 2 lib, 3 3 stdenv, 4 - makeWrapper, 4 + makeBinaryWrapper, 5 5 buildGoModule, 6 6 fetchFromGitHub, 7 7 installShellFiles, 8 - git, 8 + gitMinimal, 9 9 gnupg, 10 10 xclip, 11 11 wl-clipboard, 12 12 passAlias ? false, 13 13 apple-sdk_14, 14 - testers, 15 14 nix-update-script, 16 - gopass, 15 + versionCheckHook, 17 16 }: 18 17 19 - buildGoModule rec { 18 + let 19 + wrapperPath = lib.makeBinPath ( 20 + [ 21 + gitMinimal 22 + gnupg 23 + xclip 24 + ] 25 + ++ lib.optionals stdenv.hostPlatform.isLinux [ 26 + wl-clipboard 27 + ] 28 + ); 29 + in 30 + buildGoModule (finalAttrs: { 20 31 pname = "gopass"; 21 32 version = "1.15.16"; 22 33 23 34 nativeBuildInputs = [ 24 35 installShellFiles 25 - makeWrapper 36 + makeBinaryWrapper 26 37 ]; 27 38 28 39 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ ··· 33 44 src = fetchFromGitHub { 34 45 owner = "gopasspw"; 35 46 repo = "gopass"; 36 - rev = "v${version}"; 47 + tag = "v${finalAttrs.version}"; 37 48 hash = "sha256-oZeik172VBSxuO3DfD5t8cKPl3AYjlyEw5x4/7g9h6o="; 38 49 }; 39 50 ··· 44 55 ldflags = [ 45 56 "-s" 46 57 "-w" 47 - "-X main.version=${version}" 48 - "-X main.commit=${src.rev}" 58 + "-X main.version=${finalAttrs.version}" 59 + "-X main.commit=${finalAttrs.src.rev}" 49 60 ]; 50 61 51 - wrapperPath = lib.makeBinPath ( 52 - [ 53 - git 54 - gnupg 55 - xclip 56 - ] 57 - ++ lib.optional stdenv.hostPlatform.isLinux wl-clipboard 58 - ); 59 - 60 62 postInstall = '' 61 63 installManPage gopass.1 62 64 installShellCompletion --cmd gopass \ ··· 73 75 --prefix PATH : "${wrapperPath}" \ 74 76 --set GOPASS_NO_REMINDER true 75 77 ''; 78 + 79 + doInstallCheck = true; 80 + nativeInstallCheckInputs = [ versionCheckHook ]; 81 + versionCheckProgramArg = "--version"; 82 + 76 83 passthru = { 77 84 inherit wrapperPath; 78 85 79 - tests.version = testers.testVersion { 80 - package = gopass; 81 - }; 82 - 83 86 updateScript = nix-update-script { }; 84 87 }; 85 88 86 - meta = with lib; { 89 + meta = { 87 90 description = "Slightly more awesome Standard Unix Password Manager for Teams. Written in Go"; 88 91 homepage = "https://www.gopass.pw/"; 89 - license = licenses.mit; 90 - maintainers = with maintainers; [ 92 + license = lib.licenses.mit; 93 + maintainers = with lib.maintainers; [ 91 94 rvolosatovs 92 95 sikmir 93 96 ]; 94 - changelog = "https://github.com/gopasspw/gopass/blob/v${version}/CHANGELOG.md"; 97 + changelog = "https://github.com/gopasspw/gopass/blob/v${finalAttrs.version}/CHANGELOG.md"; 95 98 96 99 longDescription = '' 97 100 gopass is a rewrite of the pass password manager in Go with the aim of ··· 104 107 ''; 105 108 mainProgram = "gopass"; 106 109 }; 107 - } 110 + })