summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-06-04 16:07:09 +0200
committerLudovic Courtès <ludo@gnu.org>2014-06-04 18:15:50 +0200
commit2c5c696c39b2d80b1e1b1f477822a6711d779b71 (patch)
treede72ce0c717bf6c1734797fdd33b70fb1f6625f4 /gnu
parent202adef2ec8d7bbfb6a7c216e96b2306e03c759f (diff)
install: Register the hydra.gnu.org key on the installation image.
* gnu/services/base.scm (hydra-key-authorization): New procedure. (guix-service): Add #:authorize-hydra-key? parameter; honor it using 'hydra-key-authorization'. * gnu/system/install.scm (installation-services): Pass #:authorize-hydra-key? #t.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm35
-rw-r--r--gnu/system/install.scm7
2 files changed, 38 insertions, 4 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 44422035243..463185d53c8 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -330,10 +330,37 @@ starting at FIRST-UID, and under GID."
330 1+ 330 1+
331 1)))) 331 1))))
332 332
333(define (hydra-key-authorization guix)
334 "Return a gexp with code to register the hydra.gnu.org public key with
335GUIX."
336 #~(unless (file-exists? "/etc/guix/acl")
337 (let ((pid (primitive-fork)))
338 (case pid
339 ((0)
340 (let* ((key (string-append #$guix
341 "/share/guix/hydra.gnu.org.pub"))
342 (port (open-file key "r0b")))
343 (format #t "registering public key '~a'...~%" key)
344 (close-port (current-input-port))
345 ;; (close-fdes 0)
346 (dup port 0)
347 (execl (string-append #$guix "/bin/guix")
348 "guix" "archive" "--authorize")
349 (exit 1)))
350 (else
351 (let ((status (cdr (waitpid pid))))
352 (unless (zero? status)
353 (format (current-error-port) "warning: \
354failed to register hydra.gnu.org public key: ~a~%" status))))))))
355
333(define* (guix-service #:key (guix guix) (builder-group "guixbuild") 356(define* (guix-service #:key (guix guix) (builder-group "guixbuild")
334 (build-accounts 10)) 357 (build-accounts 10) authorize-hydra-key?)
335 "Return a service that runs the build daemon from GUIX, and has 358 "Return a service that runs the build daemon from GUIX, and has
336BUILD-ACCOUNTS user accounts available under BUILD-USER-GID." 359BUILD-ACCOUNTS user accounts available under BUILD-USER-GID.
360
361When AUTHORIZE-HYDRA-KEY? is true, the hydra.gnu.org public key provided by
362GUIX is authorized upon activation, meaning that substitutes from
363hydra.gnu.org are used by default."
337 (mlet %store-monad ((accounts (guix-build-accounts build-accounts 364 (mlet %store-monad ((accounts (guix-build-accounts build-accounts
338 #:group builder-group))) 365 #:group builder-group)))
339 (return (service 366 (return (service
@@ -349,7 +376,9 @@ BUILD-ACCOUNTS user accounts available under BUILD-USER-GID."
349 (user-groups (list (user-group 376 (user-groups (list (user-group
350 (name builder-group) 377 (name builder-group)
351 (members (map user-account-name 378 (members (map user-account-name
352 user-accounts))))))))) 379 user-accounts)))))
380 (activate (and authorize-hydra-key?
381 (hydra-key-authorization guix)))))))
353 382
354(define %base-services 383(define %base-services
355 ;; Convenience variable holding the basic services. 384 ;; Convenience variable holding the basic services.
diff --git a/gnu/system/install.scm b/gnu/system/install.scm
index c69e51b2b54..707f6b6c86c 100644
--- a/gnu/system/install.scm
+++ b/gnu/system/install.scm
@@ -77,7 +77,12 @@ You have been warned. Thanks for being so brave.
77 77
78 ;; The usual services. 78 ;; The usual services.
79 (syslog-service) 79 (syslog-service)
80 (guix-service) 80
81 ;; The build daemon. Register the hydra.gnu.org key as trusted.
82 ;; This allows the installation process to use substitutes by
83 ;; default.
84 (guix-service #:authorize-hydra-key? #t)
85
81 (nscd-service)))) 86 (nscd-service))))
82 87
83(define %issue 88(define %issue