2022-06-16 17:23:12 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2021-02-05 17:12:51 +00:00
|
|
|
, buildPythonPackage
|
2020-11-06 00:33:48 +00:00
|
|
|
, click
|
|
|
|
, colorama
|
|
|
|
, enum34
|
|
|
|
, fetchPypi
|
|
|
|
, git
|
|
|
|
, gnugrep
|
|
|
|
, gnupg
|
|
|
|
, nose
|
|
|
|
, pbr
|
|
|
|
, pexpect
|
|
|
|
, pythonAtLeast
|
|
|
|
, pythonOlder
|
|
|
|
, substituteAll
|
|
|
|
, tree
|
|
|
|
, xclip
|
|
|
|
}:
|
|
|
|
|
2022-10-30 15:09:59 +00:00
|
|
|
# Use the `pypass` top-level attribute, if you're interested in the
|
|
|
|
# application
|
2020-11-06 00:33:48 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pypass";
|
|
|
|
version = "0.2.1";
|
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
|
|
|
sha256 = "1nm4mj7pd7gz4ghic6b3wrnd1b59hd1f0axavdabfl79wy511l7r";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Set absolute nix store paths to the executables that pypass uses
|
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./mark-executables.patch;
|
|
|
|
git_exec = "${git}/bin/git";
|
|
|
|
grep_exec = "${gnugrep}/bin/grep";
|
|
|
|
gpg_exec = "${gnupg}/bin/gpg2";
|
|
|
|
tree_exec = "${tree}/bin/tree";
|
|
|
|
xclip_exec = "${xclip}/bin/xclip";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
# Remove enum34 requirement if Python >= 3.4
|
2021-02-05 17:12:51 +00:00
|
|
|
postPatch = lib.optionalString (pythonAtLeast "3.4") ''
|
2020-11-06 00:33:48 +00:00
|
|
|
substituteInPlace requirements.txt --replace "enum34" ""
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ pbr ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
click
|
|
|
|
colorama
|
|
|
|
pexpect
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optional (pythonOlder "3.4") enum34;
|
2020-11-06 00:33:48 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ nose ];
|
2020-11-06 00:33:48 +00:00
|
|
|
|
|
|
|
# Configuration so that the tests work
|
|
|
|
preCheck = ''
|
|
|
|
HOME=$TEMP ${git}/bin/git config --global user.email "nix-builder@nixos.org"
|
|
|
|
HOME=$TEMP ${git}/bin/git config --global user.name "Nix Builder"
|
|
|
|
HOME=$TEMP ${git}/bin/git config --global pull.ff only
|
|
|
|
HOME=$TEMP make setup_gpg
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Run tests but exclude the test that uses clipboard as I wasn't able to make
|
|
|
|
# it work - probably the X clipboard just doesn't work in the build
|
|
|
|
# environment..
|
|
|
|
checkPhase = ''
|
|
|
|
runHook preCheck
|
|
|
|
HOME=$TEMP GNUPGHOME=pypass/tests/gnupg nosetests -v --exclude=test_show_clip .
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
broken = stdenv.isDarwin;
|
2020-11-06 00:33:48 +00:00
|
|
|
description = "Password manager pass in Python";
|
|
|
|
homepage = "https://github.com/aviau/python-pass";
|
2021-02-05 17:12:51 +00:00
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
platforms = platforms.all;
|
|
|
|
maintainers = with maintainers; [ jluttine ];
|
2020-11-06 00:33:48 +00:00
|
|
|
};
|
|
|
|
}
|