daemon: Add `--no-substitutes'.
Suggested by Mark H. Weaver. * nix/nix-daemon/guix-daemon.cc (GUIX_OPT_NO_SUBSTITUTES): New macro. (options): Add `--no-substitutes'. (parse_opt): Add `GUIX_OPT_NO_SUBSTITUTES' case. (main): Leave `settings.substituters' empty when `settings.useSubstitutes' is false.
This commit is contained in:
parent
ea0ee755bd
commit
6858f9d132
|
@ -295,6 +295,10 @@ The following command-line options are supported:
|
||||||
Take users from @var{group} to run build processes (@pxref{Setting Up
|
Take users from @var{group} to run build processes (@pxref{Setting Up
|
||||||
the Daemon, build users}).
|
the Daemon, build users}).
|
||||||
|
|
||||||
|
@item --no-substitutes
|
||||||
|
Do not use substitutes for build products. That is, always build things
|
||||||
|
locally instead of allowing downloads of pre-built binaries.
|
||||||
|
|
||||||
@item --cache-failures
|
@item --cache-failures
|
||||||
Cache build failures. By default, only successful builds are cached.
|
Cache build failures. By default, only successful builds are cached.
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,7 @@ builds derivations on behalf of its clients.";
|
||||||
#define GUIX_OPT_DEBUG 9
|
#define GUIX_OPT_DEBUG 9
|
||||||
#define GUIX_OPT_CHROOT_DIR 10
|
#define GUIX_OPT_CHROOT_DIR 10
|
||||||
#define GUIX_OPT_LISTEN 11
|
#define GUIX_OPT_LISTEN 11
|
||||||
|
#define GUIX_OPT_NO_SUBSTITUTES 12
|
||||||
|
|
||||||
static const struct argp_option options[] =
|
static const struct argp_option options[] =
|
||||||
{
|
{
|
||||||
|
@ -90,6 +91,8 @@ static const struct argp_option options[] =
|
||||||
},
|
},
|
||||||
{ "build-users-group", GUIX_OPT_BUILD_USERS_GROUP, "GROUP", 0,
|
{ "build-users-group", GUIX_OPT_BUILD_USERS_GROUP, "GROUP", 0,
|
||||||
"Perform builds as a user of GROUP" },
|
"Perform builds as a user of GROUP" },
|
||||||
|
{ "no-substitutes", GUIX_OPT_NO_SUBSTITUTES, 0, 0,
|
||||||
|
"Do not use substitutes" },
|
||||||
{ "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0,
|
{ "cache-failures", GUIX_OPT_CACHE_FAILURES, 0, 0,
|
||||||
"Cache build failures" },
|
"Cache build failures" },
|
||||||
{ "lose-logs", GUIX_OPT_LOSE_LOGS, 0, 0,
|
{ "lose-logs", GUIX_OPT_LOSE_LOGS, 0, 0,
|
||||||
|
@ -152,6 +155,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
||||||
exit (EXIT_FAILURE);
|
exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case GUIX_OPT_NO_SUBSTITUTES:
|
||||||
|
settings.useSubstitutes = false;
|
||||||
|
break;
|
||||||
case GUIX_OPT_DEBUG:
|
case GUIX_OPT_DEBUG:
|
||||||
verbosity = lvlDebug;
|
verbosity = lvlDebug;
|
||||||
break;
|
break;
|
||||||
|
@ -202,15 +208,20 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
/* Use our substituter by default. */
|
/* Use our substituter by default. */
|
||||||
settings.substituters.clear ();
|
settings.substituters.clear ();
|
||||||
|
settings.useSubstitutes = true;
|
||||||
|
|
||||||
|
argp_parse (&argp, argc, argv, 0, 0, 0);
|
||||||
|
|
||||||
|
if (settings.useSubstitutes)
|
||||||
|
{
|
||||||
string subs = getEnv ("NIX_SUBSTITUTERS", "default");
|
string subs = getEnv ("NIX_SUBSTITUTERS", "default");
|
||||||
|
|
||||||
if (subs == "default")
|
if (subs == "default")
|
||||||
settings.substituters.push_back (settings.nixLibexecDir
|
settings.substituters.push_back (settings.nixLibexecDir
|
||||||
+ "/guix/substitute-binary");
|
+ "/guix/substitute-binary");
|
||||||
else
|
else
|
||||||
settings.substituters = tokenizeString<Strings> (subs, ":");
|
settings.substituters = tokenizeString<Strings> (subs, ":");
|
||||||
|
}
|
||||||
|
|
||||||
argp_parse (&argp, argc, argv, 0, 0, 0);
|
|
||||||
|
|
||||||
if (geteuid () == 0 && settings.buildUsersGroup.empty ())
|
if (geteuid () == 0 && settings.buildUsersGroup.empty ())
|
||||||
fprintf (stderr, "warning: daemon is running as root, so "
|
fprintf (stderr, "warning: daemon is running as root, so "
|
||||||
|
|
Loading…
Reference in New Issue