mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
services: guix-publish: Use socket activation when possible.
* gnu/services/base.scm (guix-publish-shepherd-service): Use 'make-systemd-constructor' when it's available and ADVERTISE? is false.
This commit is contained in:
parent
9eca13094d
commit
b06ecc5751
1 changed files with 30 additions and 17 deletions
|
@ -1877,13 +1877,7 @@ (define (config->compression-options config)
|
||||||
(match-record config <guix-publish-configuration>
|
(match-record config <guix-publish-configuration>
|
||||||
(guix port host nar-path cache workers ttl negative-ttl
|
(guix port host nar-path cache workers ttl negative-ttl
|
||||||
cache-bypass-threshold advertise?)
|
cache-bypass-threshold advertise?)
|
||||||
(list (shepherd-service
|
(let ((command #~(list #$(file-append guix "/bin/guix")
|
||||||
(provision '(guix-publish))
|
|
||||||
(requirement `(user-processes
|
|
||||||
guix-daemon
|
|
||||||
,@(if advertise? '(avahi-daemon) '())))
|
|
||||||
(start #~(make-forkexec-constructor
|
|
||||||
(list #$(file-append guix "/bin/guix")
|
|
||||||
"publish" "-u" "guix-publish"
|
"publish" "-u" "guix-publish"
|
||||||
"-p" #$(number->string port)
|
"-p" #$(number->string port)
|
||||||
#$@(config->compression-options config)
|
#$@(config->compression-options config)
|
||||||
|
@ -1913,17 +1907,36 @@ (define (config->compression-options config)
|
||||||
"--cache-bypass-threshold="
|
"--cache-bypass-threshold="
|
||||||
(number->string
|
(number->string
|
||||||
cache-bypass-threshold)))
|
cache-bypass-threshold)))
|
||||||
#~()))
|
#~())))
|
||||||
|
(options #~(#:environment-variables
|
||||||
|
;; Make sure we run in a UTF-8 locale so we can produce
|
||||||
|
;; nars for packages that contain UTF-8 file names such
|
||||||
|
;; as 'nss-certs'. See <https://bugs.gnu.org/26948>.
|
||||||
|
(list (string-append "GUIX_LOCPATH="
|
||||||
|
#$glibc-utf8-locales "/lib/locale")
|
||||||
|
"LC_ALL=en_US.utf8")
|
||||||
|
#:log-file "/var/log/guix-publish.log"))
|
||||||
|
(endpoints #~(let ((ai (false-if-exception
|
||||||
|
(getaddrinfo #$host
|
||||||
|
#$(number->string port)
|
||||||
|
AI_NUMERICSERV))))
|
||||||
|
(if (pair? ai)
|
||||||
|
(list (endpoint (addrinfo:addr (car ai))))
|
||||||
|
'()))))
|
||||||
|
(list (shepherd-service
|
||||||
|
(provision '(guix-publish))
|
||||||
|
(requirement `(user-processes
|
||||||
|
guix-daemon
|
||||||
|
,@(if advertise? '(avahi-daemon) '())))
|
||||||
|
|
||||||
;; Make sure we run in a UTF-8 locale so we can produce
|
;; Use lazy socket activation unless ADVERTISE? is true: in that
|
||||||
;; nars for packages that contain UTF-8 file names such
|
;; case the process should start right away to advertise itself.
|
||||||
;; as 'nss-certs'. See <https://bugs.gnu.org/26948>.
|
(start #~(if (and (defined? 'make-systemd-constructor) ;> 0.9.0?
|
||||||
#:environment-variables
|
#$(not advertise?))
|
||||||
(list (string-append "GUIX_LOCPATH="
|
(make-systemd-constructor
|
||||||
#$glibc-utf8-locales "/lib/locale")
|
#$command #$endpoints #$@options)
|
||||||
"LC_ALL=en_US.utf8")
|
(make-forkexec-constructor #$command #$@options)))
|
||||||
#:log-file "/var/log/guix-publish.log"))
|
(stop #~(make-kill-destructor)))))))
|
||||||
(stop #~(make-kill-destructor))))))
|
|
||||||
|
|
||||||
(define %guix-publish-accounts
|
(define %guix-publish-accounts
|
||||||
(list (user-group (name "guix-publish") (system? #t))
|
(list (user-group (name "guix-publish") (system? #t))
|
||||||
|
|
Loading…
Reference in a new issue