summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-10-09 13:25:41 +0200
committerLudovic Courtès <ludo@gnu.org>2014-10-09 23:51:19 +0200
commit9176607ec4cffb85b46e71af49bbc8a330aec5c3 (patch)
treefff85fb1ca12965acaa29f8aaa650237f2b2f56d /nix
parent74c7af9fb83bd4803b0f2cad4e6439bfad75edf0 (diff)
downloadguix-9176607ec4cffb85b46e71af49bbc8a330aec5c3.tar.gz
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.
Diffstat (limited to 'nix')
-rw-r--r--nix/nix-daemon/guix-daemon.cc15
1 files changed, 12 insertions, 3 deletions
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;