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