service: Add shepherd discover action.
* gnu/services/base.scm (shepherd-discover-action): New procedure, (guix-shepherd-service)[<actions>]: add it, [<start>]: honor it. * doc/guix.texi (Invoking guix-daemon): Document it.
This commit is contained in:
parent
92f7c11af2
commit
e461d3b750
2 changed files with 36 additions and 4 deletions
|
@ -1606,6 +1606,14 @@ Servers may serve substitute over HTTP, unencrypted, so anyone on the
|
||||||
LAN can see what software you’re installing.
|
LAN can see what software you’re installing.
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
|
It is also possible to enable or disable substitute server discovery at
|
||||||
|
run-time by running:
|
||||||
|
|
||||||
|
@example
|
||||||
|
herd discover guix-daemon on
|
||||||
|
herd discover guix-daemon off
|
||||||
|
@end example
|
||||||
|
|
||||||
@item --disable-deduplication
|
@item --disable-deduplication
|
||||||
@cindex deduplication
|
@cindex deduplication
|
||||||
Disable automatic file ``deduplication'' in the store.
|
Disable automatic file ``deduplication'' in the store.
|
||||||
|
|
|
@ -1568,6 +1568,27 @@ proxy of 'guix-daemon'...~%")
|
||||||
(environ environment)
|
(environ environment)
|
||||||
#t)))))
|
#t)))))
|
||||||
|
|
||||||
|
(define shepherd-discover-action
|
||||||
|
;; Shepherd action to enable or disable substitute servers discovery.
|
||||||
|
(shepherd-action
|
||||||
|
(name 'discover)
|
||||||
|
(documentation
|
||||||
|
"Enable or disable substitute servers discovery and restart the
|
||||||
|
'guix-daemon'.")
|
||||||
|
(procedure #~(lambda* (_ status)
|
||||||
|
(let ((environment (environ)))
|
||||||
|
(if (and status
|
||||||
|
(string=? status "on"))
|
||||||
|
(begin
|
||||||
|
(format #t "enable substitute servers discovery~%")
|
||||||
|
(setenv "discover" "on"))
|
||||||
|
(begin
|
||||||
|
(format #t "disable substitute servers discovery~%")
|
||||||
|
(unsetenv "discover")))
|
||||||
|
(action 'guix-daemon 'restart)
|
||||||
|
(environ environment)
|
||||||
|
#t)))))
|
||||||
|
|
||||||
(define (guix-shepherd-service config)
|
(define (guix-shepherd-service config)
|
||||||
"Return a <shepherd-service> for the Guix daemon service with CONFIG."
|
"Return a <shepherd-service> for the Guix daemon service with CONFIG."
|
||||||
(match-record config <guix-configuration>
|
(match-record config <guix-configuration>
|
||||||
|
@ -1579,7 +1600,8 @@ proxy of 'guix-daemon'...~%")
|
||||||
(documentation "Run the Guix daemon.")
|
(documentation "Run the Guix daemon.")
|
||||||
(provision '(guix-daemon))
|
(provision '(guix-daemon))
|
||||||
(requirement '(user-processes))
|
(requirement '(user-processes))
|
||||||
(actions (list shepherd-set-http-proxy-action))
|
(actions (list shepherd-set-http-proxy-action
|
||||||
|
shepherd-discover-action))
|
||||||
(modules '((srfi srfi-1)
|
(modules '((srfi srfi-1)
|
||||||
(ice-9 match)
|
(ice-9 match)
|
||||||
(gnu build shepherd)))
|
(gnu build shepherd)))
|
||||||
|
@ -1594,6 +1616,9 @@ proxy of 'guix-daemon'...~%")
|
||||||
;; the 'set-http-proxy' action.
|
;; the 'set-http-proxy' action.
|
||||||
(or (getenv "http_proxy") #$http-proxy))
|
(or (getenv "http_proxy") #$http-proxy))
|
||||||
|
|
||||||
|
(define discover?
|
||||||
|
(or (getenv "discover") #$discover?))
|
||||||
|
|
||||||
;; Start the guix-daemon from a container, when supported,
|
;; Start the guix-daemon from a container, when supported,
|
||||||
;; to solve an installation issue. See the comment below for
|
;; to solve an installation issue. See the comment below for
|
||||||
;; more details.
|
;; more details.
|
||||||
|
@ -1608,9 +1633,8 @@ proxy of 'guix-daemon'...~%")
|
||||||
#$@(if use-substitutes?
|
#$@(if use-substitutes?
|
||||||
'()
|
'()
|
||||||
'("--no-substitutes"))
|
'("--no-substitutes"))
|
||||||
#$@(if discover?
|
(string-append "--discover="
|
||||||
'("--discover=yes")
|
(if discover? "yes" "no"))
|
||||||
'())
|
|
||||||
"--substitute-urls" #$(string-join substitute-urls)
|
"--substitute-urls" #$(string-join substitute-urls)
|
||||||
#$@extra-options
|
#$@extra-options
|
||||||
|
|
||||||
|
|
Reference in a new issue