lol
1{ stdenv, fetchurl
2, coreutils, gnused, getopt, pwgen, git, tree, gnupg, which
3, makeWrapper
4
5, xclip ? null, xdotool ? null, dmenu ? null
6, x11Support ? !stdenv.isDarwin
7}:
8
9assert x11Support -> xclip != null
10 && xdotool != null
11 && dmenu != null;
12
13stdenv.mkDerivation rec {
14 version = "1.6.5";
15 name = "password-store-${version}";
16
17 src = fetchurl {
18 url = "http://git.zx2c4.com/password-store/snapshot/${name}.tar.xz";
19 sha256 = "05bk3lrp5jwg0v338lvylp7glpliydzz4jf5pjr6k3kagrv3jyik";
20 };
21
22 patches =
23 [ ./program-name.patch ] ++
24 stdenv.lib.optional stdenv.isDarwin ./no-darwin-getopt.patch;
25
26 buildInputs = [ makeWrapper ];
27
28 meta = with stdenv.lib; {
29 description = "Stores, retrieves, generates, and synchronizes passwords securely";
30 homepage = http://www.passwordstore.org/;
31 license = licenses.gpl2Plus;
32 maintainers = with maintainers; [ lovek323 the-kenny ];
33 platforms = platforms.unix;
34
35 longDescription = ''
36 pass is a very simple password store that keeps passwords inside gpg2
37 encrypted files inside a simple directory tree residing at
38 ~/.password-store. The pass utility provides a series of commands for
39 manipulating the password store, allowing the user to add, remove, edit,
40 synchronize, generate, and manipulate passwords.
41 '';
42 };
43
44 preInstall = ''
45 mkdir -p "$out/share/bash-completion/completions"
46 mkdir -p "$out/share/zsh/site-functions"
47 mkdir -p "$out/share/fish/vendor_completions.d"
48 '';
49
50 installFlags = [ "PREFIX=$(out)" ];
51
52 postInstall = ''
53 # Install Emacs Mode. NOTE: We can't install the necessary
54 # dependencies (s.el and f.el) here. The user has to do this
55 # himself.
56 mkdir -p "$out/share/emacs/site-lisp"
57 cp "contrib/emacs/password-store.el" "$out/share/emacs/site-lisp/"
58
59 ${if x11Support then ''
60 cp "contrib/dmenu/passmenu" "$out/bin/"
61 '' else ""}
62 '';
63
64 wrapperPath = with stdenv.lib; makeBinPath ([
65 coreutils
66 gnused
67 getopt
68 git
69 gnupg
70 pwgen
71 tree
72 which
73 ] ++ ifEnable x11Support [ dmenu xclip xdotool ]);
74
75 postFixup = ''
76 # Fix program name in --help
77 substituteInPlace $out/bin/pass \
78 --replace "\$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}"
88 '';
89}