1{
2 lib,
3 fetchurl,
4 python3Packages,
5 gnupg,
6 pass,
7}:
8
9python3Packages.buildPythonApplication rec {
10 pname = "pass-import";
11 version = "3.5";
12 format = "setuptools";
13
14 src = fetchurl {
15 url = "https://github.com/roddhjav/${pname}/releases/download/v${version}/${pname}-${version}.tar.gz";
16 hash = "sha256-+wrff3OxPkAGu1Mn4Kl0KN4FmvIAb+MnaERcD5ScDNc=";
17 };
18
19 propagatedBuildInputs = with python3Packages; [
20 cryptography
21 defusedxml
22 jsonpath-ng
23 pyaml
24 pykeepass
25 python-magic # similar API to "file-magic", but already in nixpkgs.
26 requests
27 secretstorage
28 zxcvbn
29 ];
30
31 nativeCheckInputs = [
32 gnupg
33 pass
34 python3Packages.pytestCheckHook
35 ];
36
37 disabledTests = [
38 "test_import_gnome_keyring" # requires dbus, which pytest doesn't support
39 ];
40
41 postInstall = ''
42 mkdir -p $out/lib/password-store/extensions
43 cp import.bash $out/lib/password-store/extensions/import.bash
44 wrapProgram $out/lib/password-store/extensions/import.bash \
45 --prefix PATH : "${python3Packages.python.withPackages (_: propagatedBuildInputs)}/bin" \
46 --prefix PYTHONPATH : "$out/${python3Packages.python.sitePackages}" \
47 --run "export PREFIX"
48 cp -r share $out/
49 '';
50
51 postCheck = ''
52 $out/bin/pimport --list-exporters --list-importers
53 '';
54
55 meta = with lib; {
56 description = "Pass extension for importing data from existing password managers";
57 mainProgram = "pimport";
58 homepage = "https://github.com/roddhjav/pass-import";
59 changelog = "https://github.com/roddhjav/pass-import/blob/v${version}/CHANGELOG.rst";
60 license = licenses.gpl3Plus;
61 maintainers = with maintainers; [
62 lovek323
63 fpletz
64 tadfisher
65 ];
66 platforms = platforms.unix;
67 };
68}