summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-03-10 22:27:04 +0100
committerLudovic Courtès <ludo@gnu.org>2022-03-10 23:46:50 +0100
commit5e34e873af088ef9aa417290bcddf5b095501614 (patch)
treefba88624a3809142c6e93308ab4f06071d88392e /gnu/services
parent199da75a8adf37381c32ee1e3028b08b94703584 (diff)
downloadguix-5e34e873af088ef9aa417290bcddf5b095501614.tar.gz
services: guix: Add 'generate-substitute-key?' field.
* gnu/services/base.scm (<guix-configuration>)[generate-substitute-key?]:
New field.
(guix-activation): Honor it.
* doc/guix.texi (Base Services): Document it.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 463f034305..f278cb76de 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -183,6 +183,7 @@
             guix-configuration-authorized-keys
             guix-configuration-use-substitutes?
             guix-configuration-substitute-urls
+            guix-configuration-generate-substitute-key?
             guix-configuration-extra-options
             guix-configuration-log-file
 
@@ -1565,6 +1566,8 @@ archive' public keys, with GUIX."
                     (default #t))
   (substitute-urls  guix-configuration-substitute-urls ;list of strings
                     (default %default-substitute-urls))
+  (generate-substitute-key? guix-configuration-generate-substitute-key?
+                            (default #t))         ;Boolean
   (chroot-directories guix-configuration-chroot-directories ;list of file-like/strings
                       (default '()))
   (max-silent-time  guix-configuration-max-silent-time ;integer
@@ -1749,14 +1752,15 @@ proxy of 'guix-daemon'...~%")
 (define (guix-activation config)
   "Return the activation gexp for CONFIG."
   (match-record config <guix-configuration>
-    (guix authorize-key? authorized-keys)
+    (guix generate-substitute-key? authorize-key? authorized-keys)
     #~(begin
         ;; Assume that the store has BUILD-GROUP as its group.  We could
         ;; otherwise call 'chown' here, but the problem is that on a COW overlayfs,
         ;; chown leads to an entire copy of the tree, which is a bad idea.
 
         ;; Generate a key pair and optionally authorize substitute server keys.
-        (unless (file-exists? "/etc/guix/signing-key.pub")
+        (unless (or #$(not generate-substitute-key?)
+                    (file-exists? "/etc/guix/signing-key.pub"))
           (system* #$(file-append guix "/bin/guix") "archive"
                    "--generate-key"))