@@ -1,10 +1,12 @@
1−{ stdenv, lib, fetchurl, fetchFromGitHub
1+{ stdenv, lib, pkgs, fetchurl, fetchFromGitHub, buildEnv
22, coreutils, gnused, getopt, git, tree, gnupg, which, procps, qrencode
33, makeWrapper
44
55, xclip ? null, xdotool ? null, dmenu ? null
66, x11Support ? !stdenv.isDarwin
7−, tombPluginSupport ? false, tomb
7+
8+# For backwards-compatibility
9+, tombPluginSupport ? false
810}:
911
1012with lib;
@@ -14,98 +16,100 @@ assert x11Support -> xclip != null
1416 && dmenu != null;
1517
1618let
17− plugins = map (p: (fetchFromGitHub {
18− owner = "roddhjav";
19− repo = "pass-${p.name}";
20− inherit (p) rev sha256;
21− }))
22− ([
23− { name = "import";
24− rev = "491935bd275f29ceac2b876b3a288011d1ce31e7";
25− sha256 = "02mbh05ab8h7kc30hz718d1d1vkjz43b96c7p0xnd92610d2q66q"; }
26− { name = "update";
27− rev = "cf576c9036fd18efb9ed29e0e9f811207b556fde";
28− sha256 = "1hhbrg6a2walrvla6q4cd3pgrqbcrf9brzjkb748735shxfn52hd"; }
29− ] ++ stdenv.lib.optional tombPluginSupport {
30− name = "tomb";
31− rev = "3368134898a42c1b758fabac625ec240e125c6be";
32− sha256 = "0qqmxfg4w3r088qhlkhs44036mya82vjflsjjhw2hk8y0wd2i6ds"; }
33− );
34−
35−in stdenv.mkDerivation rec {
36− version = "1.7.1";
37− name = "password-store-${version}";
38−
39− src = fetchurl {
40− url = "http://git.zx2c4.com/password-store/snapshot/${name}.tar.xz";
41− sha256 = "0scqkpll2q8jhzcgcsh9kqz0gwdpvynivqjmmbzax2irjfaiklpn";
42− };
19+ passExtensions = import ./extensions { inherit pkgs; };
20+
21+ env = extensions:
22+ let
23+ selected = extensions passExtensions
24+ ++ stdenv.lib.optional tombPluginSupport passExtensions.tomb;
25+ in buildEnv {
26+ name = "pass-extensions-env";
27+ paths = selected;
28+ buildInputs = concatMap (x: x.buildInputs) selected;
29+ };
30+
31+ generic = extensionsEnv: extraPassthru: stdenv.mkDerivation rec {
32+ version = "1.7.1";
33+ name = "password-store-${version}";
34+
35+ src = fetchurl {
36+ url = "http://git.zx2c4.com/password-store/snapshot/${name}.tar.xz";
37+ sha256 = "0scqkpll2q8jhzcgcsh9kqz0gwdpvynivqjmmbzax2irjfaiklpn";
38+ };
39+
40+ patches = [ ./set-correct-program-name-for-sleep.patch
41+ ] ++ stdenv.lib.optional stdenv.isDarwin ./no-darwin-getopt.patch;
42+
43+ nativeBuildInputs = [ makeWrapper ];
44+
45+ buildInputs = [ extensionsEnv ];
46+
47+ installFlags = [ "PREFIX=$(out)" "WITH_ALLCOMP=yes" ];
48+
49+ postInstall = ''
50+ # Install Emacs Mode. NOTE: We can't install the necessary
51+ # dependencies (s.el and f.el) here. The user has to do this
52+ # himself.
53+ mkdir -p "$out/share/emacs/site-lisp"
54+ cp "contrib/emacs/password-store.el" "$out/share/emacs/site-lisp/"
55+ '' + optionalString x11Support ''
56+ cp "contrib/dmenu/passmenu" "$out/bin/"
57+ '';
4358
44− patches = [ ./set-correct-program-name-for-sleep.patch
45− ] ++ stdenv.lib.optional stdenv.isDarwin ./no-darwin-getopt.patch;
46−
47− nativeBuildInputs = [ makeWrapper ];
48−
49− installFlags = [ "PREFIX=$(out)" "WITH_ALLCOMP=yes" ];
50−
51− postInstall = ''
52− # plugins
53− ${stdenv.lib.concatStringsSep "\n" (map (plugin: ''
54− pushd ${plugin}
55− PREFIX=$out make install
56− popd
57− '') plugins)}
58−
59− # Install Emacs Mode. NOTE: We can't install the necessary
60− # dependencies (s.el and f.el) here. The user has to do this
61− # himself.
62− mkdir -p "$out/share/emacs/site-lisp"
63− cp "contrib/emacs/password-store.el" "$out/share/emacs/site-lisp/"
64− '' + optionalString x11Support ''
65− cp "contrib/dmenu/passmenu" "$out/bin/"
66− '';
67−
68− wrapperPath = with stdenv.lib; makeBinPath ([
69− coreutils
70− getopt
71− git
72− gnupg
73− gnused
74− tree
75− which
76− qrencode
77− procps
78− ] ++ optional tombPluginSupport tomb
79− ++ ifEnable x11Support [ dmenu xclip xdotool ]);
80−
81− postFixup = ''
82− # Fix program name in --help
83− substituteInPlace $out/bin/pass \
84− --replace 'PROGRAM="''${0##*/}"' "PROGRAM=pass"
85−
86− # Ensure all dependencies are in PATH
87− wrapProgram $out/bin/pass \
88− --prefix PATH : "${wrapperPath}"
89− '' + stdenv.lib.optionalString x11Support ''
90− # We just wrap passmenu with the same PATH as pass. It doesn't
91− # need all the tools in there but it doesn't hurt either.
92− wrapProgram $out/bin/passmenu \
93− --prefix PATH : "$out/bin:${wrapperPath}"
94− '';
95−
96− meta = with stdenv.lib; {
97− description = "Stores, retrieves, generates, and synchronizes passwords securely";
98− homepage = https://www.passwordstore.org/;
99− license = licenses.gpl2Plus;
100− maintainers = with maintainers; [ lovek323 the-kenny fpletz ];
101− platforms = platforms.unix;
102−
103− longDescription = ''
104− pass is a very simple password store that keeps passwords inside gpg2
105− encrypted files inside a simple directory tree residing at
106− ~/.password-store. The pass utility provides a series of commands for
107− manipulating the password store, allowing the user to add, remove, edit,
108− synchronize, generate, and manipulate passwords.
59+ wrapperPath = with stdenv.lib; makeBinPath ([
60+ coreutils
61+ getopt
62+ git
63+ gnupg
64+ gnused
65+ tree
66+ which
67+ qrencode
68+ procps
69+ ] ++ ifEnable x11Support [ dmenu xclip xdotool ]);
70+
71+ postFixup = ''
72+ # Link extensions env
73+ rmdir $out/lib/password-store/extensions
74+ ln -s ${extensionsEnv}/lib/password-store/extensions $out/lib/password-store/.
75+
76+ # Fix program name in --help
77+ substituteInPlace $out/bin/pass \
78+ --replace 'PROGRAM="''${0##*/}"' "PROGRAM=pass"
79+
80+ # Ensure all dependencies are in PATH
81+ wrapProgram $out/bin/pass \
82+ --prefix PATH : "${wrapperPath}"
83+ '' + stdenv.lib.optionalString x11Support ''
84+ # We just wrap passmenu with the same PATH as pass. It doesn't
85+ # need all the tools in there but it doesn't hurt either.
86+ wrapProgram $out/bin/passmenu \
87+ --prefix PATH : "$out/bin:${wrapperPath}"
10988 '';
89+
90+ passthru = {
91+ extensions = passExtensions;
92+ } // extraPassthru;
93+
94+ meta = with stdenv.lib; {
95+ description = "Stores, retrieves, generates, and synchronizes passwords securely";
96+ homepage = https://www.passwordstore.org/;
97+ license = licenses.gpl2Plus;
98+ maintainers = with maintainers; [ lovek323 the-kenny fpletz tadfisher ];
99+ platforms = platforms.unix;
100+
101+ longDescription = ''
102+ pass is a very simple password store that keeps passwords inside gpg2
103+ encrypted files inside a simple directory tree residing at
104+ ~/.password-store. The pass utility provides a series of commands for
105+ manipulating the password store, allowing the user to add, remove, edit,
106+ synchronize, generate, and manipulate passwords.
107+ '';
108+ };
110109 };
110+
111+in
112+
113+generic (env (_: [])) {
114+ withExtensions = extensions: generic (env extensions) {};
111115}