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-06-21 18:11:32 +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)))
|