1{
2 lib,
3 stdenv,
4 makeBinaryWrapper,
5 buildGoModule,
6 fetchFromGitHub,
7 installShellFiles,
8 gitMinimal,
9 gnupg,
10 xclip,
11 wl-clipboard,
12 passAlias ? false,
13 apple-sdk_14,
14 nix-update-script,
15 versionCheckHook,
16}:
17
18let
19 wrapperPath = lib.makeBinPath (
20 [
21 gitMinimal
22 gnupg
23 xclip
24 ]
25 ++ lib.optionals stdenv.hostPlatform.isLinux [
26 wl-clipboard
27 ]
28 );
29in
30buildGoModule (finalAttrs: {
31 pname = "gopass";
32 version = "1.15.18";
33
34 nativeBuildInputs = [
35 installShellFiles
36 makeBinaryWrapper
37 ];
38
39 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
40 # For ScreenCaptureKit.h, see https://github.com/NixOS/nixpkgs/pull/358760#discussion_r1858327365
41 apple-sdk_14
42 ];
43
44 src = fetchFromGitHub {
45 owner = "gopasspw";
46 repo = "gopass";
47 tag = "v${finalAttrs.version}";
48 hash = "sha256-0vAZfcI/cUS/+x9clX9dV1q9yPOP3ZYPrn7hLPaYy/U=";
49 };
50
51 vendorHash = "sha256-HH0VU/JdRbpLK4pp2WOewXmv7Slu35iC2tFZ1TYWn5s=";
52
53 subPackages = [ "." ];
54
55 ldflags = [
56 "-s"
57 "-w"
58 "-X main.version=${finalAttrs.version}"
59 "-X main.commit=${finalAttrs.src.rev}"
60 ];
61
62 postInstall = ''
63 installManPage gopass.1
64 installShellCompletion --cmd gopass \
65 --zsh zsh.completion \
66 --bash bash.completion \
67 --fish fish.completion
68 ''
69 + lib.optionalString passAlias ''
70 ln -s $out/bin/gopass $out/bin/pass
71 '';
72
73 postFixup = ''
74 wrapProgram $out/bin/gopass \
75 --prefix PATH : "${wrapperPath}" \
76 --set GOPASS_NO_REMINDER true
77 '';
78
79 doInstallCheck = true;
80 nativeInstallCheckInputs = [ versionCheckHook ];
81 versionCheckProgramArg = "--version";
82
83 passthru = {
84 inherit wrapperPath;
85
86 updateScript = nix-update-script { };
87 };
88
89 meta = {
90 description = "Slightly more awesome Standard Unix Password Manager for Teams. Written in Go";
91 homepage = "https://www.gopass.pw/";
92 license = lib.licenses.mit;
93 maintainers = with lib.maintainers; [
94 rvolosatovs
95 sikmir
96 ];
97 changelog = "https://github.com/gopasspw/gopass/blob/v${finalAttrs.version}/CHANGELOG.md";
98
99 longDescription = ''
100 gopass is a rewrite of the pass password manager in Go with the aim of
101 making it cross-platform and adding additional features. Our target
102 audience are professional developers and sysadmins (and especially teams
103 of those) who are well versed with a command line interface. One explicit
104 goal for this project is to make it more approachable to non-technical
105 users. We go by the UNIX philosophy and try to do one thing and do it
106 well, providing a stellar user experience and a sane, simple interface.
107 '';
108 mainProgram = "gopass";
109 };
110})