From 9176607ec4cffb85b46e71af49bbc8a330aec5c3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 9 Oct 2014 13:25:41 +0200 Subject: daemon: Add '--substitute-urls' option. * nix/nix-daemon/guix-daemon.cc (GUIX_OPT_SUBSTITUTE_URLS): New macro. (GUIX_OPT_NO_BUILD_HOOK, GUIX_OPT_GC_KEEP_OUTPUTS, GUIX_OPT_GC_KEEP_DERIVATIONS): Renumber. (options): Add '--substitute-urls'. (parse_opt): Honor it. (main): Add 'settings.set' call for the default "substitute-urls" value. * guix/scripts/substitute-binary.scm (daemon-options, find-daemon-option): New procedures. (%cache-url): Define based on the "substitute-urls" daemon option. * doc/guix.texi (Invoking guix-daemon): Document '--substitute-urls'. (Substitutes): Mention it. --- nix/nix-daemon/guix-daemon.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'nix/nix-daemon') diff --git a/nix/nix-daemon/guix-daemon.cc b/nix/nix-daemon/guix-daemon.cc index 8c63bed0bf..d1d4541971 100644 --- a/nix/nix-daemon/guix-daemon.cc +++ b/nix/nix-daemon/guix-daemon.cc @@ -68,9 +68,10 @@ builds derivations on behalf of its clients."; #define GUIX_OPT_CHROOT_DIR 10 #define GUIX_OPT_LISTEN 11 #define GUIX_OPT_NO_SUBSTITUTES 12 -#define GUIX_OPT_NO_BUILD_HOOK 13 -#define GUIX_OPT_GC_KEEP_OUTPUTS 14 -#define GUIX_OPT_GC_KEEP_DERIVATIONS 15 +#define GUIX_OPT_SUBSTITUTE_URLS 13 +#define GUIX_OPT_NO_BUILD_HOOK 14 +#define GUIX_OPT_GC_KEEP_OUTPUTS 15 +#define GUIX_OPT_GC_KEEP_DERIVATIONS 16 static const struct argp_option options[] = { @@ -98,6 +99,8 @@ static const struct argp_option options[] = "Perform builds as a user of GROUP" }, { "no-substitutes", GUIX_OPT_NO_SUBSTITUTES, 0, 0, "Do not use substitutes" }, + { "substitute-urls", GUIX_OPT_SUBSTITUTE_URLS, "URLS", 0, + "Use URLS as the default list of substitute providers" }, { "no-build-hook", GUIX_OPT_NO_BUILD_HOOK, 0, 0, "Do not use the 'build hook'" }, { "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0, @@ -192,6 +195,9 @@ parse_opt (int key, char *arg, struct argp_state *state) exit (EXIT_FAILURE); } break; + case GUIX_OPT_SUBSTITUTE_URLS: + settings.set ("substitute-urls", arg); + break; case GUIX_OPT_NO_SUBSTITUTES: settings.set ("build-use-substitutes", "false"); break; @@ -280,6 +286,9 @@ main (int argc, char *argv[]) settings.substituters.clear (); settings.set ("build-use-substitutes", "true"); + /* Use our substitute server by default. */ + settings.set ("substitute-urls", "http://hydra.gnu.org"); + #ifdef HAVE_DAEMON_OFFLOAD_HOOK /* Use our build hook for distributed builds by default. */ settings.useBuildHook = true; -- cgit v1.2.3