1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 click,
6 colorama,
7 fetchPypi,
8 git,
9 gnugrep,
10 gnupg,
11 pbr,
12 pexpect,
13 pythonAtLeast,
14 pytestCheckHook,
15 setuptools,
16 substituteAll,
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 (substituteAll {
36 src = ./mark-executables.patch;
37 git_exec = "${git}/bin/git";
38 grep_exec = "${gnugrep}/bin/grep";
39 gpg_exec = "${gnupg}/bin/gpg2";
40 tree_exec = "${tree}/bin/tree";
41 xclip_exec = "${xclip}/bin/xclip";
42 })
43 ];
44
45 # Remove enum34 requirement if Python >= 3.4
46 postPatch = lib.optionalString (pythonAtLeast "3.4") ''
47 substituteInPlace requirements.txt --replace "enum34" ""
48 '';
49
50 build-system = [ setuptools ];
51
52 nativeBuildInputs = [ pbr ];
53
54 dependencies = [
55 click
56 colorama
57 pexpect
58 ];
59
60 nativeCheckInputs = [ pytestCheckHook ];
61
62 # Configuration so that the tests work
63 preCheck = ''
64 export HOME=$(mktemp -d)
65 export GNUPGHOME=pypass/tests/gnupg
66 ${git}/bin/git config --global user.email "nix-builder@nixos.org"
67 ${git}/bin/git config --global user.name "Nix Builder"
68 ${git}/bin/git config --global pull.ff only
69 make setup_gpg
70 '';
71
72 # Presumably this test needs the X clipboard, which we don't have
73 # as the test environment is non-graphical.
74 disabledTests = [ "test_show_clip" ];
75
76 meta = {
77 broken = stdenv.isDarwin;
78 description = "Password manager pass in Python";
79 mainProgram = "pypass";
80 homepage = "https://github.com/aviau/python-pass";
81 license = lib.licenses.gpl3Plus;
82 platforms = lib.platforms.all;
83 maintainers = with lib.maintainers; [ jluttine ];
84 };
85}