dotfiles-guix/modules/freya/certs.scm

51 lines
1.9 KiB
Scheme

(define-module (freya certs)
#: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"
#:recursive? #t))
(build-system trivial-build-system)
(license license:mpl2.0)
(home-page "https://freya.cat")
(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)))