Fixed channels.scm gexpr

master
noah metz 2023-12-01 17:17:15 -07:00
parent 81f7c59bd8
commit 8978b00640
1 changed files with 45 additions and 30 deletions

@ -154,30 +154,40 @@
(define (file-like-pair? val) (define (file-like-pair? val)
(let ((name (car val)) (let ((name (car val))
(file (cdr val))) (file (cdr val)))
(and (string? name) (file-like? file)))) (and (string? name)
(file-like? file))))
(define alist-of-file-like? (list-of file-like-pair?)) (define alist-of-file-like?
(list-of file-like-pair?))
(define-configuration/no-serialization metznet-system-configuration (define-configuration/no-serialization metznet-system-configuration
(certs (file-like le-certs) (certs (file-like le-certs)
"certificate package") "certificate package")
(vpn-pki-dir (maybe-string (let ((pki-dir (getenv "VPN_PKI_DIR"))) (vpn-pki-dir (maybe-string (let ((pki-dir
(or pki-dir (getenv
%unset-value))) "VPN_PKI_DIR")))
"openvpn pki directory") (or
(user-shells (alist-of-file-like (list (cons "/bin/zsh" zsh))) "user shells to link") pki-dir
%unset-value)))
"openvpn pki directory")
(user-shells (alist-of-file-like (list (cons
"/bin/zsh"
zsh)))
"user shells to link")
(channels-file (file-like (scheme-file (channels-file (file-like (scheme-file
"channels.scm" "channels.scm"
#~(append (list #~(append (list
(channel (channel
(name 'metznet-channel) (name 'metznet-channel)
(url (url
"https://git.metznet.ca/MetzNet/metznet-channel.git")) "https://git.metznet.ca/MetzNet/metznet-channel.git"))
(channel (channel
(name 'nonguix) (name 'nonguix)
(url (url
"https://gitlab.com/nonguix/nonguix.git")) "https://gitlab.com/nonguix/nonguix.git")))
%default-channels)))) %default-channels)))
"channels.scm") "channels.scm")
(pam-services (list-of-strings (list (pam-services (list-of-strings (list
"su" "su"
@ -201,33 +211,38 @@
(list (pam-mkhomedir-service configuration))) (list (pam-mkhomedir-service configuration)))
(define (shell-paths configuration) (define (shell-paths configuration)
(map car (metznet-system-configuration-user-shells configuration))) (map car
(metznet-system-configuration-user-shells configuration)))
(define (shell-packages configuration) (define (shell-packages configuration)
(map cdr (metznet-system-configuration-user-shells configuration))) (map cdr
(metznet-system-configuration-user-shells configuration)))
(define (metznet-activation configuration) (define (metznet-activation configuration)
#~(for-each #~(for-each (lambda (path package)
(lambda (begin
(path package) (display path)
(begin (display "\n")
(display path) (display package)
(display "\n") (display "\n")
(display package) (unless (access? path F_OK)
(display "\n") (symlink (string-append package path) path))))
(unless (access? path F_OK) (symlink (string-append package path) path)))) (list #$@(shell-paths configuration))
(list #$@(shell-paths configuration)) (list #$@(shell-packages configuration)))) (list #$@(shell-packages configuration))))
(define (metznet-etc-service configuration) (define (metznet-etc-service configuration)
(let ((channels-file (metznet-system-configuration-channels-file configuration)) (let ((channels-file (metznet-system-configuration-channels-file
(pki-dir (metznet-system-configuration-vpn-pki-dir configuration))) configuration))
(if (maybe-value-set? pki-dir) (pki-dir (metznet-system-configuration-vpn-pki-dir configuration)))
`(("guix/channels.scm" ,channels-file) (if (maybe-value-set? pki-dir)
("openvpn/ta.key" ,(local-file (string-append pki-dir "/ta.key"))) `(("guix/channels.scm" ,channels-file)
("openvpn/ca.crt" ,(local-file (string-append pki-dir "/ca.crt"))) ("openvpn/ta.key" ,(local-file (string-append pki-dir "/ta.key")))
("openvpn/client.key" ,(local-file (string-append pki-dir "/client.key"))) ("openvpn/ca.crt" ,(local-file (string-append pki-dir "/ca.crt")))
("openvpn/client.crt" ,(local-file (string-append pki-dir "/client.crt")))) ("openvpn/client.key" ,(local-file (string-append pki-dir
`(("guix/channels.scm" ,channels-file))))) "/client.key")))
("openvpn/client.crt" ,(local-file (string-append pki-dir
"/client.crt"))))
`(("guix/channels.scm" ,channels-file)))))
(define metznet-service-type (define metznet-service-type
(service-type (name 'metznet-service) (service-type (name 'metznet-service)