dotfiles-guix/modules/home-packages/certs.scm

52 lines
2 KiB
Scheme
Raw Normal View History

2023-10-05 02:34:41 +00:00
(define-module (home-packages 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 "../home-config/ca-certs"
#:recursive? #t))
(build-system trivial-build-system)
(license license:mpl2.0)
2024-03-06 23:56:31 +00:00
(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)))