aboutsummaryrefslogtreecommitdiff
path: root/guix/scripts/publish.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-03-22 14:00:06 +0100
committerLudovic Courtès <ludo@gnu.org>2017-03-22 14:05:59 +0100
commit4bb5e0aeb3b7f5396dff1fcd2b85b65af5e07038 (patch)
treead9e934e9ef76951fbc0354f2afb160599b298ae /guix/scripts/publish.scm
parentcdd7a7d2106d295ca10fc23a94b6e9d1c8b5a82a (diff)
downloadgnu-guix-4bb5e0aeb3b7f5396dff1fcd2b85b65af5e07038.tar
gnu-guix-4bb5e0aeb3b7f5396dff1fcd2b85b65af5e07038.tar.gz
publish: Add '--nar-path'.
* guix/scripts/publish.scm (show-help, %options): Add '--nar-path'. (%default-options): Add 'nar-path'. (guix-publish): Honor it.
Diffstat (limited to 'guix/scripts/publish.scm')
-rw-r--r--guix/scripts/publish.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/scripts/publish.scm b/guix/scripts/publish.scm
index ba5be04818..d8ac72f4ef 100644
--- a/guix/scripts/publish.scm
+++ b/guix/scripts/publish.scm
@@ -72,6 +72,8 @@ Publish ~a over HTTP.\n") %store-directory)
(display (_ "
--ttl=TTL announce narinfos can be cached for TTL seconds"))
(display (_ "
+ --nar-path=PATH use PATH as the prefix for nar URLs"))
+ (display (_ "
--public-key=FILE use FILE as the public key for signatures"))
(display (_ "
--private-key=FILE use FILE as the private key for signatures"))
@@ -152,6 +154,9 @@ compression disabled~%"))
(leave (_ "~a: invalid duration~%") arg))
(alist-cons 'narinfo-ttl (time-second duration)
result))))
+ (option '("nar-path") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'nar-path arg result)))
(option '("public-key") #t #f
(lambda (opt name arg result)
(alist-cons 'public-key-file arg result)))
@@ -167,6 +172,9 @@ compression disabled~%"))
(define %default-options
`((port . 8080)
+ ;; By default, serve nars under "/nar".
+ (nar-path . "nar")
+
(public-key-file . ,%public-key-file)
(private-key-file . ,%private-key-file)
@@ -589,6 +597,7 @@ blocking."
(sockaddr:addr addr)
port)))
(socket (open-server-socket address))
+ (nar-path (assoc-ref opts 'nar-path))
(repl-port (assoc-ref opts 'repl))
;; Read the key right away so that (1) we fail early on if we can't
@@ -615,5 +624,6 @@ consider using the '--user' option!~%")))
(repl:spawn-server (repl:make-tcp-server-socket #:port repl-port)))
(with-store store
(run-publish-server socket store
+ #:nar-path nar-path
#:compression compression
#:narinfo-ttl ttl))))))