summary refs log tree commit diff
path: root/gnu/services
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2020-11-22 15:15:17 +0100
committerMathieu Othacehe <othacehe@gnu.org>2020-11-29 15:08:26 +0100
commit276e494b2a1fd87874d80e2bdc3aa1fb833b76f2 (patch)
tree852860bd1aea0bb32ca3946d58b5d3876c4ae260 /gnu/services
parent375cc7dea20da7117c9459e4a4d15144095e015b (diff)
downloadguix-276e494b2a1fd87874d80e2bdc3aa1fb833b76f2.tar.gz
publish: Add advertising support.
* guix/scripts/publish.scm (%options): Add "--advertise" option.
(show-help): Document it.
(service-name): New procedure,
(publish-service-type): new variable.
(run-publish-server): Add "advertise?" and "port" parameters. Use them to publish
the server using Avahi.
(guix-publish): Pass the "advertise?" option to "run-publish-server".
* gnu/services/base.scm (<guix-publish-configuration>): Add "advertise?"
field.
(guix-publish-shepherd-service): Honor it.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/base.scm8
1 files changed, 7 insertions, 1 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 3fc4d5f885..e3b347293e 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1744,6 +1744,8 @@ proxy of 'guix-daemon'...~%")
            (default 80))
   (host    guix-publish-configuration-host        ;string
            (default "localhost"))
+  (advertise? guix-publish-advertise?       ;boolean
+              (default #f))
   (compression       guix-publish-configuration-compression
                      (thunked)
                      (default (default-compression this-record
@@ -1790,7 +1792,8 @@ raise a deprecation warning if the 'compression-level' field was used."
                    lst))))
 
   (match-record config <guix-publish-configuration>
-    (guix port host nar-path cache workers ttl cache-bypass-threshold)
+    (guix port host nar-path cache workers ttl cache-bypass-threshold
+          advertise?)
     (list (shepherd-service
            (provision '(guix-publish))
            (requirement '(guix-daemon))
@@ -1801,6 +1804,9 @@ raise a deprecation warning if the 'compression-level' field was used."
                            #$@(config->compression-options config)
                            (string-append "--nar-path=" #$nar-path)
                            (string-append "--listen=" #$host)
+                           #$@(if advertise?
+                                  #~("--advertise")
+                                  #~())
                            #$@(if workers
                                   #~((string-append "--workers="
                                                     #$(number->string