(define-public passff-host (package (name "passff-host") (version "1.2.3") (home-page "https://github.com/passff/passff-host/") (source (origin (method git-fetch) (uri (git-reference (url home-page) (commit version))) (file-name (git-file-name name version)) (sha256 (base32 "1p18l1jh20x4v8dj64z9qjlp96fxsl5h069iynxfpbkzj6hd74yl")) )) ;; NOTE: python-build-system is used instead of copy-build-system to ;; automatically pick up the Python 3 dependency and to wrap the installed ;; Python script. ;; FIXME: The passff.json in etc/ needs to go into a browser-dependent ;; location to work with that specific browser. How to install it to the ;; right location needs to be figured out and documented. (build-system python-build-system) (arguments (list #:tests? #f ; There are no tests #:phases #~(modify-phases %standard-phases (replace 'build (lambda _ ;; TODO? Add password-store as an input and embed the store ;; path to the "pass" executable. (substitute* "src/passff.py" (("_VERSIONHOLDER_") #$(package-version this-package)) ;; (("\"pass\"") (string-append ;; "\"" ;; #$(this-package-input "password-store") ;; "/bin/pass\"")) (("\"PATH\": .*") (string-join (list "\"PATH\"" " \"/run/current-system/profile/bin" "/run/booted-system/profile/bin" (string-append #$(this-package-input "password-store") "/bin\",\n")) ":")) ))) (replace 'install (lambda _ (let ((etc (string-append #$output "/etc")) (libexec (string-append #$output "/libexec"))) ;; Install the host script in libexec (install-file "src/passff.py" libexec) ;; Insert the script path and install the (example) ;; native host manifest to etc (substitute* "src/passff.json" (("PLACEHOLDER") (string-append libexec "/passff.py"))) (for-each (lambda (dir) (install-file "src/passff.json" dir)) (list etc ;; Generic location for easier access ;; Chromium location based on src/install_host_app.sh (string-append etc "/chromium/native-messaging-hosts") ;; Firefox location based on src/install_host_app.sh (string-append #$output "/lib/mozilla/native-messaging-hosts") ;; Icecat location derived from the above Firefox location (string-append #$output "/lib/icecat/native-messaging-hosts"))) ))) ))) (inputs (list password-store)) (synopsis "Host app for the WebExtension PassFF") (description "This piece of software wraps around the zx2c4 pass shell command. It has to be installed for the PassFF browser extension to work properly.") (license li:gpl2)))