|
|
|
@ -149,9 +149,23 @@
|
|
|
|
|
(define list-of-strings?
|
|
|
|
|
(list-of string?))
|
|
|
|
|
|
|
|
|
|
(define-maybe/no-serialization string)
|
|
|
|
|
|
|
|
|
|
(define (file-like-pair? val)
|
|
|
|
|
(let ((name (car val))
|
|
|
|
|
(file (cdr val)))
|
|
|
|
|
(and (string? name) (file-like? file))))
|
|
|
|
|
|
|
|
|
|
(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")
|
|
|
|
|
(channels-file (file-like (scheme-file
|
|
|
|
|
"channels.scm"
|
|
|
|
|
#~(append (list
|
|
|
|
@ -186,19 +200,34 @@
|
|
|
|
|
(define (pam-mkhomedir-services configuration)
|
|
|
|
|
(list (pam-mkhomedir-service configuration)))
|
|
|
|
|
|
|
|
|
|
(define (shell-paths configuration)
|
|
|
|
|
(map car (metznet-system-configuration-user-shells configuration)))
|
|
|
|
|
|
|
|
|
|
(define (shell-packages configuration)
|
|
|
|
|
(map cdr (metznet-system-configuration-user-shells configuration)))
|
|
|
|
|
|
|
|
|
|
(define (metznet-activation configuration)
|
|
|
|
|
#~(if (access? "/bin/zsh" F_OK)
|
|
|
|
|
(display "zsh already linked")
|
|
|
|
|
#~(for-each
|
|
|
|
|
(lambda
|
|
|
|
|
(path package)
|
|
|
|
|
(begin
|
|
|
|
|
(display "linking zsh")
|
|
|
|
|
(symlink (string-append #$zsh "/bin/zsh") "/bin/zsh"))))
|
|
|
|
|
(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)
|
|
|
|
|
`(("guix/channels.scm" ,(metznet-system-configuration-channels-file configuration))
|
|
|
|
|
("openvpn/ta.key" ,(local-file "ta.key"))
|
|
|
|
|
("openvpn/ca.crt" ,(local-file "ca.crt"))
|
|
|
|
|
("openvpn/client.crt" ,(local-file "client.crt"))
|
|
|
|
|
("openvpn/client.key" ,(local-file "client.key"))))
|
|
|
|
|
(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)
|
|
|
|
|