about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/pass/extensions/import.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/pass/extensions/import.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/pass/extensions/import.nix20
1 files changed, 18 insertions, 2 deletions
diff --git a/nixpkgs/pkgs/tools/security/pass/extensions/import.nix b/nixpkgs/pkgs/tools/security/pass/extensions/import.nix
index be2492112c3f..7fa9ce3177e5 100644
--- a/nixpkgs/pkgs/tools/security/pass/extensions/import.nix
+++ b/nixpkgs/pkgs/tools/security/pass/extensions/import.nix
@@ -4,6 +4,7 @@
 , python3Packages
 , gnupg
 , pass
+, makeWrapper
 }:
 
 python3Packages.buildPythonApplication rec {
@@ -17,9 +18,14 @@ python3Packages.buildPythonApplication rec {
     sha256 = "sha256-nH2xAqWfMT+Brv3z9Aw6nbvYqArEZjpM28rKsRPihqA=";
   };
 
-  # by default, tries to install scripts/pimport, which is a bash wrapper around "python -m pass_import ..."
-  # This is a better way to do the same, and takes advantage of the existing Nix python environments
   patches = [
+    (fetchpatch {
+      name = "support-for-keepass-4.0.0.patch";
+      url = "https://github.com/roddhjav/pass-import/commit/86cfb1bb13a271fefe1e70f24be18e15a83a04d8.patch";
+      sha256 = "0mrlblqlmwl9gqs2id4rl4sivrcclsv6zyc6vjqi78kkqmnwzhxh";
+    })
+    # by default, tries to install scripts/pimport, which is a bash wrapper around "python -m pass_import ..."
+    # This is a better way to do the same, and takes advantage of the existing Nix python environments
     # from https://github.com/roddhjav/pass-import/pull/138
     (fetchpatch {
       name = "pass-import-pr-138-pimport-entrypoint.patch";
@@ -50,6 +56,16 @@ python3Packages.buildPythonApplication rec {
     $out/bin/pimport --list-exporters --list-importers
   '';
 
+  postInstall = ''
+    mkdir -p $out/lib/password-store/extensions
+    cp ${src}/scripts/import.bash $out/lib/password-store/extensions/import.bash
+    wrapProgram $out/lib/password-store/extensions/import.bash \
+      --prefix PATH : "${python3Packages.python.withPackages(_: propagatedBuildInputs)}/bin" \
+      --prefix PYTHONPATH : "$out/${python3Packages.python.sitePackages}" \
+      --run "export PREFIX"
+    cp -r ${src}/share $out/
+  '';
+
   meta = with lib; {
     description = "Pass extension for importing data from existing password managers";
     homepage = "https://github.com/roddhjav/pass-import";