52 lines
2 KiB
Scheme
52 lines
2 KiB
Scheme
|
(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)
|
||
|
(home-page "https://tylerm.dev")
|
||
|
(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)))
|