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