(define-module (dnie) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix download) #:use-module (gnu packages elf) #:use-module (gnu packages gcc) #:use-module (gnu packages gnupg) #:use-module (gnu packages security-token) #:use-module (guix build-system copy) #:use-module ((guix licenses) #:prefix license:)) (define-public dnie-cert (package (name "dnie-cert") (version "1.6.8") (source (origin (method url-fetch) (uri (string-append "https://www.dnielectronico.es/descargas/distribuciones_linux/" "libpkcs11-dnie_" version "_amd64.deb")) (sha256 (base32 "028v4vv5c2lf5f9iv25838lymh3rsaxv4s9f94g61jn0n8w787c5")))) (build-system copy-build-system) (arguments (list #:phases #~(modify-phases %standard-phases (add-before 'install 'unpack (lambda _ (invoke "ar" "-x" (string-append "libpkcs11-dnie_" #$version "_amd64.deb")) (invoke "tar" "-xvf" "data.tar.xz")))) #:install-plan ''(("usr/share/libpkcs11-dnie/AC RAIZ DNIE 2.crt" "/share/libpkcs11-dnie/AC_RAIZ_DNIE_2.crt")))) (home-page "https://www.dnielectronico.es/PortalDNIe/") (synopsis "Certs for Spanish DNIe") (description "Certificate only") (license (license:non-copyleft "https://www.dnielectronico.es/PortalDNIe/" "Copyright (C) 2010 Dirección General de Policía y de la Guardia Civil All rights reserved.")))) (define-public libpkcs-dnie (package (name "libpkcs-dnie") (version "1.6.8") (source (origin (method url-fetch) (uri (string-append "https://www.dnielectronico.es/descargas/distribuciones_linux/" "libpkcs11-dnie_" version "_amd64.deb")) (sha256 (base32 "028v4vv5c2lf5f9iv25838lymh3rsaxv4s9f94g61jn0n8w787c5")))) (supported-systems (list "x86_64-linux")) (build-system copy-build-system) (inputs (list libassuan libgpg-error patchelf pcsc-lite (list gcc "lib"))) (arguments (list #:phases #~(modify-phases %standard-phases (add-before 'install 'unpack (lambda _ (invoke "ar" "-x" (string-append "libpkcs11-dnie_" #$version "_amd64.deb")) (invoke "tar" "-xvf" "data.tar.xz"))) (add-before 'install 'patchelf (lambda _ (invoke "patchelf" "usr/lib/libpkcs11-dnie-cryptopp.so" "--set-rpath" (string-append #$gcc:lib "/lib")) (invoke "patchelf" "usr/lib/libpkcs11-dnie.so" "--set-rpath" (string-join (list #$gcc:lib #$libassuan #$libgpg-error #$pcsc-lite #$output) "/lib:" 'suffix))))) #:install-plan ''(("usr/lib" "/lib") ("usr/share/doc" "/share/doc") ("usr/share/libpkcs11-dnie/AC RAIZ DNIE 2.crt" "/share/libpkcs11-dnie/AC_RAIZ_DNIE_2.crt")))) (home-page "https://www.dnielectronico.es/PortalDNIe/") (synopsis "Libraries and certs for Spanish DNIe") (description "After installation you'll need to: @itemize @item Install the PKCS#11 module in your browser: `guix build dnie`/lib/libpkcs11-dnie.so @item Install the DNIe certificate in your browser `guix build dnie`/share/libpkcs11-dnie/AC_RAIZ_DNIE_2.crt @end itemize NOTE: maybe you just want to use OpenSC instead.") (license (license:non-copyleft "https://www.dnielectronico.es/PortalDNIe/" "Copyright (C) 2010 Dirección General de Policía y de la Guardia Civil All rights reserved."))))