Subject: [PATCH v2] gnu: Add pass-import

From: Abhishek Cherath <[email-masked]>
Date: Fri, 29 Mar 2024 16:38:57 -0400

* gnu/packages/password-utils.scm (pass-import): New variable.

Change-Id: I92d78083140e29bb3b79ae260e6335a49877d779
---
 gnu/packages/password-utils.scm | 69 +++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index 1dbf138ad4..e50251278c 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -111,6 +111,9 @@ (define-module (gnu packages password-utils)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages python-crypto)
+  #:use-module (gnu packages python-build)
+  #:use-module (gnu packages haskell-xyz)
   #:use-module (gnu packages rdesktop)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages ruby)
@@ -1155,6 +1158,72 @@ (define-public pass-git-helper
 your git repositories.  This is achieved by explicitly defining mappings
 between hosts and entries in the password store.")
     (license license:lgpl3+)))
+    
+(define-public pass-import
+  (package
+    (name "pass-import")
+    (version "3.5")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/roddhjav/pass-import")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0xj8nh1jcmgsllykzhg4ybxfyjxzpwqsxl9sl86965247arkgw9r"))))
+    (build-system python-build-system)
+    (arguments
+     (list
+      ;; WARNING: 21/146 tests have errors
+      ;; I think they're due to path issues,
+      ;; and don't seem to impact operation
+      #:tests? #f
+      #:phases #~(modify-phases %standard-phases
+                   (add-before 'build 'patch-base-and-share
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (substitute* "setup.py"
+                         (("^base = .*$")
+                          (string-append "base = '"
+                                         #$output "'\n"))
+                         (("^share = .*$")
+                          (string-append "share = Path('"
+                                         #$output "', 'share')\n")))))
+                   (add-after 'build 'make-docs
+                     (lambda* (#:key inputs #:allow-other-keys)
+                       (invoke "pandoc"
+                               "-t"
+                               "man"
+                               "-s"
+                               "-o"
+                               "share/man/man1/pass-import.1"
+                               "share/man/man1/pass-import.md")
+                       (invoke "pandoc"
+                               "-t"
+                               "man"
+                               "-s"
+                               "-o"
+                               "share/man/man1/pimport.1"
+                               "share/man/man1/pimport.md"))))))
+    (native-inputs (list pandoc))
+    (propagated-inputs (list python-pyaml
+                             python-zxcvbn
+                             python-requests
+                             python-pykeepass
+                             python-secretstorage
+                             python-defusedxml
+                             python-secretstorage
+                             python-cryptography-rust
+                             password-store))
+    (home-page "https://github.com/roddhjav/pass-import")
+    (synopsis
+     "Pass extension to import passwords from other password managers")
+    (description
+     "Pass import is a password store extension allowing you to
+import your password database to a password store repository conveniently.  It
+natively supports import from 62 different password managers.  More manager
+support can easily be added.")
+    (license license:gpl3)))
 
 (define-public john-the-ripper-jumbo
   (let ((official-version "1.9.0")

base-commit: b05bb6608c7f25ddce6b563194ba5a3007009282
-- 
2.41.0