summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2025-01-11 22:10:06 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2025-01-11 22:10:06 +0100
commitf3cad49546c99a28e54751d259da29ba5e1c29f6 (patch)
treefecc64b9a2c6f25f70e1d927984d654af9edb2cc
parent37d3a6ac1b8d5445ed63aece730d513c65742c61 (diff)
dnie: add spanish DNIe support packages
-rw-r--r--dnie.scm107
1 files changed, 107 insertions, 0 deletions
diff --git a/dnie.scm b/dnie.scm
new file mode 100644
index 0000000..604b4d9
--- /dev/null
+++ b/dnie.scm
@@ -0,0 +1,107 @@
+(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."))))