diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-11-03 17:23:10 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-11-03 18:11:45 +0100 |
commit | 1c52181f33ec6c2b91f1361f7251769dd29c6ef2 (patch) | |
tree | 871cf6f9e3eba2ede8939e21b7c0e7c78f2b8a89 /gnu/services/base.scm | |
parent | 00bfa7ea25b4612d730b057308b304d0131bee03 (diff) | |
download | guix-1c52181f33ec6c2b91f1361f7251769dd29c6ef2.tar.gz |
services: Add 'guix-publish-service'.
* gnu/services/base.scm (<guix-publish-configuration>): New record type. (guix-publish-dmd-service): New procedure. (%guix-publish-accounts, guix-publish-service-type): New variables. (guix-publish-service): New procedure. * doc/guix.texi (Invoking guix publish): Add xref to 'guix-publish-service' anchor. (Base Services): Document 'guix-publish-service'.
Diffstat (limited to 'gnu/services/base.scm')
-rw-r--r-- | gnu/services/base.scm | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 604416b985..9d495565ad 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -76,6 +76,10 @@ guix-configuration? guix-service guix-service-type + guix-publish-configuration + guix-publish-configuration? + guix-publish-service + guix-publish-service-type %base-services)) @@ -705,6 +709,11 @@ If configuration file name @var{config-file} is not specified, use some reasonable default settings." (service syslog-service-type config-file)) + +;;; +;;; Guix services. +;;; + (define* (guix-build-accounts count #:key (group "guixbuild") (first-uid 30001) @@ -842,6 +851,58 @@ failed to register hydra.gnu.org public key: ~a~%" status)))))))) @var{config}." (service guix-service-type config)) + +(define-record-type* <guix-publish-configuration> + guix-publish-configuration make-guix-publish-configuration + guix-publish-configuration? + (guix guix-publish-configuration-guix ;package + (default guix)) + (port guix-publish-configuration-port ;number + (default 80)) + (host guix-publish-configuration-host ;string + (default "localhost"))) + +(define guix-publish-dmd-service + (match-lambda + (($ <guix-publish-configuration> guix port host) + (list (dmd-service + (provision '(guix-publish)) + (requirement '(guix-daemon)) + (start #~(make-forkexec-constructor + (list (string-append #$guix "/bin/guix") + "publish" "-u" "guix-publish" + "-p" #$(number->string port) + (string-append "--listen=" #$host)))) + (stop #~(make-kill-destructor))))))) + +(define %guix-publish-accounts + (list (user-group (name "guix-publish") (system? #t)) + (user-account + (name "guix-publish") + (group "guix-publish") + (system? #t) + (comment "guix publish user") + (home-directory "/var/empty") + (shell #~(string-append #$shadow "/sbin/nologin"))))) + +(define guix-publish-service-type + (service-type (name 'guix-publish) + (extensions + (list (service-extension dmd-root-service-type + guix-publish-dmd-service) + (service-extension account-service-type + (const %guix-publish-accounts)))))) + +(define* (guix-publish-service #:key (guix guix) (port 80) (host "localhost")) + "Return a service that runs @command{guix publish} listening on @var{host} +and @var{port} (@pxref{Invoking guix publish}). + +This assumes that @file{/etc/guix} already contains a signing key pair as +created by @command{guix archive --generate-key} (@pxref{Invoking guix +archive}). If that is not the case, the service will fail to start." + (service guix-publish-service-type + (guix-publish-configuration (guix guix) (port port) (host host)))) + ;;; ;;; Udev. |