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