3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/security/pass/extensions/import.nix

60 lines
1.6 KiB
Nix
Raw Normal View History

2019-10-28 10:30:12 +00:00
{ stdenv, pass, fetchFromGitHub, pythonPackages, makeWrapper, fetchpatch }:
2018-04-18 20:27:03 +01:00
let
2019-10-28 10:30:12 +00:00
pythonEnv = pythonPackages.python.withPackages (p: [
p.defusedxml
p.setuptools
p.pyaml
]);
2018-04-18 20:27:03 +01:00
in stdenv.mkDerivation rec {
pname = "pass-import";
2019-10-28 10:30:12 +00:00
version = "2.6";
2018-04-18 20:27:03 +01:00
src = fetchFromGitHub {
owner = "roddhjav";
repo = "pass-import";
rev = "v${version}";
2019-10-28 10:30:12 +00:00
sha256 = "1q8rln4djh2z8j2ycm654df5y6anm5iv2r19spgy07c3fnisxlac";
2018-04-18 20:27:03 +01:00
};
nativeBuildInputs = [ makeWrapper ];
buildInputs = [ pythonEnv ];
2019-10-28 10:30:12 +00:00
patches = [
# https://github.com/roddhjav/pass-import/pull/91
(fetchpatch {
url = "https://github.com/roddhjav/pass-import/commit/6ccaf639e92df45bd400503757ae4aa2c5c030d7.patch";
sha256 = "0lw9vqvbqcy96s7v7nz0i1bdx93x7qr13azymqypcdhjwmq9i63h";
})
];
postPatch = ''
sed -i -e 's|$0|${pass}/bin/pass|' import.bash
'';
2018-04-18 20:27:03 +01:00
dontBuild = true;
2019-10-28 10:30:12 +00:00
installFlags = [
"PREFIX=$(out)"
"BASHCOMPDIR=$(out)/etc/bash_completion.d"
];
2018-04-18 20:27:03 +01:00
postFixup = ''
2019-10-28 10:30:12 +00:00
install -D pass_import.py $out/${pythonPackages.python.sitePackages}/pass_import.py
2018-04-18 20:27:03 +01:00
wrapProgram $out/lib/password-store/extensions/import.bash \
--prefix PATH : "${pythonEnv}/bin" \
2019-10-28 10:30:12 +00:00
--prefix PYTHONPATH : "$out/${pythonPackages.python.sitePackages}" \
--run "export PREFIX"
2018-04-18 20:27:03 +01:00
'';
meta = with stdenv.lib; {
description = "Pass extension for importing data from existing password managers";
homepage = "https://github.com/roddhjav/pass-import";
2018-04-18 20:27:03 +01:00
license = licenses.gpl3Plus;
maintainers = with maintainers; [ lovek323 fpletz tadfisher ];
2018-04-18 20:27:03 +01:00
platforms = platforms.unix;
};
}