]> git.ekhem.eu.org Git - guix.git/commitdiff
[guix] Enable nonguix substitutes.
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 6 Sep 2026 17:13:09 +0000 (17:13 +0000)
committerJakub Czajka <jakub@ekhem.eu.org>
Sun, 22 Nov 2026 10:42:39 +0000 (10:42 +0000)
conf/common/nonguix-signing-key.pub [new file with mode: 0644]
conf/common/substitutes.scm [new file with mode: 0644]
system.scm
tests/vps-system.scm
vps-system.scm

diff --git a/conf/common/nonguix-signing-key.pub b/conf/common/nonguix-signing-key.pub
new file mode 100644 (file)
index 0000000..32ddac6
--- /dev/null
@@ -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 (file)
index 0000000..ab4c357
--- /dev/null
@@ -0,0 +1,22 @@
+;; Copyright (c) 2026 Jakub Czajka <jakub@ekhem.eu.org>
+;; 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))))
index 21e2755ee8f02edd264ef5019bff27758a2e754d..9c14adc1aebf92e5cd4f0b79a0c127db4fbf2c77 100644 (file)
@@ -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)
                       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)))))))
index ad8d0cca7ffbe82479547284d9ac189413abd0ec..999cbe8378d16eb27a33ce65d6e0a3d4d749a741 100644 (file)
           (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"
                    (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
index 30d69ddfbfd9747415870b2322d0240b45959ae8..a51ca9adb32707b151be840e87fb46c6401ee1ab 100644 (file)
@@ -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)
 
 (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")
     ;; 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