1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 click,
6 colorama,
7 fetchPypi,
8 gitMinimal,
9 gnugrep,
10 gnupg,
11 pbr,
12 pexpect,
13 pythonAtLeast,
14 pytestCheckHook,
15 setuptools,
16 replaceVars,
17 tree,
18 xclip,
19}:
20
21# Use the `pypass` top-level attribute, if you're interested in the
22# application
23buildPythonPackage rec {
24 pname = "pypass";
25 version = "0.2.1";
26 pyproject = true;
27
28 src = fetchPypi {
29 inherit pname version;
30 hash = "sha256-+dAQiufpULdU26or4EKDqazQbOZjGRbhI/+ddo+spNo=";
31 };
32
33 # Set absolute nix store paths to the executables that pypass uses
34 patches = [
35 (replaceVars ./mark-executables.patch {
36 git_exec = "${gitMinimal}/bin/git";
37 grep_exec = "${gnugrep}/bin/grep";
38 gpg_exec = "${gnupg}/bin/gpg2";
39 tree_exec = "${tree}/bin/tree";
40 xclip_exec = "${xclip}/bin/xclip";
41 })
42 ];
43
44 # Remove enum34 requirement if Python >= 3.4
45 pythonRemoveDeps = lib.optionals (pythonAtLeast "3.4") [
46 "enum34"
47 ];
48
49 build-system = [ setuptools ];
50
51 nativeBuildInputs = [ pbr ];
52
53 dependencies = [
54 click
55 colorama
56 pexpect
57 ];
58
59 nativeCheckInputs = [
60 gitMinimal
61 pytestCheckHook
62 ];
63
64 # Configuration so that the tests work
65 preCheck = ''
66 export HOME=$(mktemp -d)
67 export GNUPGHOME=pypass/tests/gnupg
68 git config --global user.email "nix-builder@nixos.org"
69 git config --global user.name "Nix Builder"
70 git config --global pull.ff only
71 make setup_gpg
72 '';
73
74 # Presumably this test needs the X clipboard, which we don't have
75 # as the test environment is non-graphical.
76 disabledTests = [ "test_show_clip" ];
77
78 meta = {
79 broken = stdenv.hostPlatform.isDarwin;
80 description = "Password manager pass in Python";
81 mainProgram = "pypass";
82 homepage = "https://github.com/aviau/python-pass";
83 license = lib.licenses.gpl3Plus;
84 platforms = lib.platforms.all;
85 maintainers = with lib.maintainers; [ jluttine ];
86 };
87}