From: Jakub Czajka Date: Sun, 6 Sep 2026 17:13:09 +0000 (+0000) Subject: [guix] Enable nonguix substitutes. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=7bfba8ab174f395b086f5511539c3dd580a3ce80;p=guix.git [guix] Enable nonguix substitutes. --- diff --git a/conf/common/nonguix-signing-key.pub b/conf/common/nonguix-signing-key.pub new file mode 100644 index 0000000..32ddac6 --- /dev/null +++ b/conf/common/nonguix-signing-key.pub @@ -0,0 +1,6 @@ +(public-key + (ecc + (curve Ed25519) + (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#) + ) + ) diff --git a/conf/common/substitutes.scm b/conf/common/substitutes.scm new file mode 100644 index 0000000..ab4c357 --- /dev/null +++ b/conf/common/substitutes.scm @@ -0,0 +1,22 @@ +;; Copyright (c) 2026 Jakub Czajka +;; License: GPL-3.0 or later. +;; +;; substitutes.scm - nonguix substitute server for the daemon. + +(define-module (conf common substitutes) + #:use-module (gnu services base) + #:use-module (guix gexp) + #:export (augment-guix-configuration)) + +(define (augment-guix-configuration config) + (let* ((substitute-url "https://substitutes.nonguix.org") + (signing-key (local-file "nonguix-signing-key.pub")) + (config-urls (guix-configuration-substitute-urls config)) + (config-keys (guix-configuration-authorized-keys config)) + (urls (append config-urls + (list substitute-url))) + (keys (append config-keys + (list signing-key)))) + (guix-configuration (inherit config) + (substitute-urls urls) + (authorized-keys keys)))) diff --git a/system.scm b/system.scm index 21e2755..9c14adc 100644 --- a/system.scm +++ b/system.scm @@ -7,7 +7,8 @@ ;; PROFILE=nonfree — allows non-free firmware. ;; PROFILE=libre — free software only. -(use-modules (conf system bluetooth) +(use-modules (conf common substitutes) + (conf system bluetooth) (conf system desktop) (conf system volume) (gnu) @@ -138,5 +139,12 @@ dwm-desktop-packages %base-packages)) (services - (append (list bluez-service %resolv-conf-service keyboard-layout-service) - %custom-desktop-services)))) + (modify-services (append (list bluez-service %resolv-conf-service + keyboard-layout-service) + %custom-desktop-services) + (guix-service-type config => + (case profile + ((nonfree) + (augment-guix-configuration config)) + ((libre) + config))))))) diff --git a/tests/vps-system.scm b/tests/vps-system.scm index ad8d0cc..999cbe8 100644 --- a/tests/vps-system.scm +++ b/tests/vps-system.scm @@ -78,6 +78,18 @@ (openssh-service-type config => (authorize-login config))))) +(define %nonguix-signing-key + "C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98") + +(define %nonguix-acl-test + `(begin + (use-modules (ice-9 string-fun) + (ice-9 textual-ports)) + (call-with-input-file "/etc/guix/acl" + (lambda (port) + (string-contains (get-string-all port) + ,%nonguix-signing-key))))) + (define (daemons-test-cases marionette) #~(begin (test-assert "services: resolv.conf is installed" @@ -87,7 +99,10 @@ (and (wait-for-tcp-port 53 #$marionette) (marionette-eval '(start-service 'ntpd) - #$marionette))))) + #$marionette))) + (test-assert "services: nonguix substitutes are authorized" + (marionette-eval '#$%nonguix-acl-test + #$marionette)))) (define %vps-test-os (marionette-operating-system (operating-system diff --git a/vps-system.scm b/vps-system.scm index 30d69dd..a51ca9a 100644 --- a/vps-system.scm +++ b/vps-system.scm @@ -11,6 +11,7 @@ #:use-module (gnu packages admin) #:use-module (gnu packages bash) #:use-module (nongnu packages linux) + #:use-module (conf common substitutes) #:use-module (conf vps sshd) #:use-module (conf vps dnscrypt) #:use-module (conf vps nginx) @@ -18,6 +19,31 @@ (use-service-modules networking shepherd) +(define %vps-base-services + (append (list + ;; DHCP — OVH delivers the static IP via DHCP + (service dhcpcd-service-type) + + %ssh-service + + ;; NTP — correct time is required for Guix substitutes + (service ntp-service-type) + + ;; dnscrypt-proxy — encrypted DNS proxy + (simple-service 'dnscrypt-proxy-daemon shepherd-root-service-type + (list dnscrypt-proxy-shepherd-service)) + + ;; Point system resolver to localhost. + ;; Uses a dedicated service type that extends + ;; etc-service-type rather than being one. + (service resolv-conf-service-type) + + %nginx-service + + ;; TODO: DNS-over-TLS on port 853. + ;; See server.git dnscrypt-proxy.conf and metadata.git. + ) %base-services)) + (define vps-operating-system (operating-system (host-name "vps") @@ -63,32 +89,9 @@ ;; Services (services - (append (list - ;; DHCP — OVH delivers the static IP via DHCP - (service dhcpcd-service-type) - - %ssh-service - - ;; NTP — correct time is required for Guix substitutes - (service ntp-service-type) - - ;; dnscrypt-proxy — encrypted DNS proxy - (simple-service 'dnscrypt-proxy-daemon - shepherd-root-service-type - (list dnscrypt-proxy-shepherd-service)) - - ;; Point system resolver to localhost. - ;; Uses a dedicated service type that extends - ;; etc-service-type rather than being one. - (service resolv-conf-service-type) - - %nginx-service - - ;; TODO: nginx stream for DNS-over-TLS on port 853. - ;; See server.git dnscrypt-proxy/dnscrypt-proxy.conf - ;; and the metadata.git Ansible playbook for the - ;; envsubst-based deployment pattern (SSL certs needed). - ) %base-services)) + (modify-services %vps-base-services + (guix-service-type config => + (augment-guix-configuration config)))) ;; Sudoers: dak can reconfigure without a password