dotfiles-guix/modules/freya/certs.scm

52 lines
1.9 KiB
Scheme
Raw Normal View History

(define-module (freya certs)
2023-10-05 02:34:41 +00:00
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix gexp)
#:use-module (guix build-system trivial)
#:use-module (guix utils)
#:use-module (guix packages)
#:use-module (gnu packages)
#:use-module (gnu packages tls)
#:use-module (gnu packages linux)
#:use-module (gnu packages base))
(define-public freya-ca-certs
(package
(name "freya-ca-certs")
(version "1")
(source (local-file "../../certs"
2023-10-05 02:34:41 +00:00
#:recursive? #t))
(build-system trivial-build-system)
(license license:mpl2.0)
(home-page "https://freya.cat")
2023-10-05 02:34:41 +00:00
(arguments
`(#:modules
((guix build utils))
#:builder
(begin
(use-modules (guix build utils)
(srfi srfi-1)
(srfi srfi-26)
(ice-9 ftw))
(let* ((ca-certificates (assoc-ref %build-inputs "source"))
(crt-suffix ".crt")
(is-certificate? (cut string-suffix? crt-suffix <>))
(certificates (filter is-certificate?
(scandir ca-certificates)))
(out (assoc-ref %outputs "out"))
(certificate-directory (string-append out "/etc/ssl/certs"))
(openssl (string-append (assoc-ref %build-inputs "openssl") "/bin/openssl")))
(mkdir-p certificate-directory)
(for-each
(lambda (cert)
(invoke
openssl "x509"
"-in" (string-append ca-certificates "/" cert)
"-outform" "PEM"
"-out" (string-append certificate-directory "/" cert ".pem")))
certificates)
#t))))
(native-inputs
(list openssl))
(synopsis "freya ca certs")
(description synopsis)))