2012-07-18 18:59:03 +00:00
|
|
|
#pragma once
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
#include "types.hh"
|
2017-04-13 18:53:23 +00:00
|
|
|
#include "config.hh"
|
2017-10-23 17:34:49 +00:00
|
|
|
#include "util.hh"
|
2006-09-04 21:06:23 +00:00
|
|
|
|
2012-07-30 23:55:41 +00:00
|
|
|
#include <map>
|
2017-09-05 18:43:42 +00:00
|
|
|
#include <limits>
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-09-05 18:43:42 +00:00
|
|
|
#include <sys/types.h>
|
2006-09-04 21:06:23 +00:00
|
|
|
|
|
|
|
namespace nix {
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
typedef enum { smEnabled, smRelaxed, smDisabled } SandboxMode;
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
extern bool useCaseHack; // FIXME
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-04-20 14:52:53 +00:00
|
|
|
struct CaseHackSetting : public BaseSetting<bool>
|
|
|
|
{
|
|
|
|
CaseHackSetting(Config * options,
|
|
|
|
const std::string & name,
|
|
|
|
const std::string & description,
|
|
|
|
const std::set<std::string> & aliases = {})
|
|
|
|
: BaseSetting<bool>(useCaseHack, name, description, aliases)
|
|
|
|
{
|
|
|
|
options->addSetting(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void set(const std::string & str) override
|
|
|
|
{
|
|
|
|
BaseSetting<bool>::set(str);
|
|
|
|
nix::useCaseHack = true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MaxBuildJobsSetting : public BaseSetting<unsigned int>
|
|
|
|
{
|
|
|
|
MaxBuildJobsSetting(Config * options,
|
|
|
|
unsigned int def,
|
|
|
|
const std::string & name,
|
|
|
|
const std::string & description,
|
|
|
|
const std::set<std::string> & aliases = {})
|
|
|
|
: BaseSetting<unsigned int>(def, name, description, aliases)
|
|
|
|
{
|
|
|
|
options->addSetting(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
void set(const std::string & str) override;
|
|
|
|
};
|
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
class Settings : public Config {
|
2012-07-31 22:19:44 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
unsigned int getDefaultCores();
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
public:
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Settings();
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
void loadConfFile();
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
void set(const string & name, const string & value);
|
2014-02-08 05:05:46 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Path nixPrefix;
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2012-07-30 23:55:41 +00:00
|
|
|
/* The directory where we store sources and derived files. */
|
|
|
|
Path nixStore;
|
|
|
|
|
|
|
|
Path nixDataDir; /* !!! fix */
|
|
|
|
|
|
|
|
/* The directory where we log various operations. */
|
|
|
|
Path nixLogDir;
|
|
|
|
|
|
|
|
/* The directory where state is stored. */
|
|
|
|
Path nixStateDir;
|
|
|
|
|
|
|
|
/* The directory where configuration files are stored. */
|
|
|
|
Path nixConfDir;
|
|
|
|
|
|
|
|
/* The directory where internal helper programs are stored. */
|
|
|
|
Path nixLibexecDir;
|
|
|
|
|
|
|
|
/* The directory where the main programs are stored. */
|
|
|
|
Path nixBinDir;
|
|
|
|
|
2013-03-08 00:24:59 +00:00
|
|
|
/* File name of the socket the daemon listens to. */
|
|
|
|
Path nixDaemonSocketFile;
|
|
|
|
|
2017-10-23 17:34:49 +00:00
|
|
|
Setting<std::string> storeUri{this, getEnv("NIX_REMOTE", "auto"), "store",
|
|
|
|
"The default Nix store to use."};
|
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> keepFailed{this, false, "keep-failed",
|
|
|
|
"Whether to keep temporary directories of failed builds."};
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> keepGoing{this, false, "keep-going",
|
|
|
|
"Whether to keep building derivations when another build fails."};
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> tryFallback{this, false, "fallback",
|
|
|
|
"Whether to fall back to building when substitution fails.",
|
|
|
|
{"build-fallback"}};
|
2012-07-30 23:55:41 +00:00
|
|
|
|
2016-04-25 14:47:46 +00:00
|
|
|
/* Whether to show build log output in real time. */
|
|
|
|
bool verboseBuild = true;
|
|
|
|
|
|
|
|
/* If verboseBuild is false, the number of lines of the tail of
|
|
|
|
the log to show if a build fails. */
|
|
|
|
size_t logLines = 10;
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
MaxBuildJobsSetting maxBuildJobs{this, 1, "max-jobs",
|
|
|
|
"Maximum number of parallel build jobs. \"auto\" means use number of cores.",
|
|
|
|
{"build-max-jobs"}};
|
2003-06-16 13:33:38 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<unsigned int> buildCores{this, getDefaultCores(), "cores",
|
2017-04-13 18:53:23 +00:00
|
|
|
"Number of CPU cores to utilize in parallel within a build, "
|
|
|
|
"i.e. by passing this number to Make via '-j'. 0 means that the "
|
|
|
|
"number of actual CPU cores on the local host ought to be "
|
2017-08-31 12:28:25 +00:00
|
|
|
"auto-detected.", {"build-cores"}};
|
2003-07-10 13:41:28 +00:00
|
|
|
|
2012-07-30 23:55:41 +00:00
|
|
|
/* Read-only mode. Don't copy stuff to the store, don't change
|
|
|
|
the database. */
|
2017-04-13 18:53:23 +00:00
|
|
|
bool readOnlyMode = false;
|
2003-07-31 13:47:13 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<std::string> thisSystem{this, SYSTEM, "system",
|
|
|
|
"The canonical Nix system name."};
|
2005-02-01 22:07:48 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<time_t> maxSilentTime{this, 0, "max-silent-time",
|
2017-04-13 18:53:23 +00:00
|
|
|
"The maximum time in seconds that a builer can go without "
|
|
|
|
"producing any output on stdout/stderr before it is killed. "
|
2017-08-31 12:28:25 +00:00
|
|
|
"0 means infinity.",
|
|
|
|
{"build-max-silent-time"}};
|
2006-12-04 13:09:16 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<time_t> buildTimeout{this, 0, "timeout",
|
2017-04-13 18:53:23 +00:00
|
|
|
"The maximum duration in seconds that a builder can run. "
|
2017-08-31 12:28:25 +00:00
|
|
|
"0 means infinity.", {"build-timeout"}};
|
2004-06-25 15:36:09 +00:00
|
|
|
|
2017-05-01 13:46:47 +00:00
|
|
|
PathSetting buildHook{this, true, nixLibexecDir + "/nix/build-remote", "build-hook",
|
|
|
|
"The path of the helper program that executes builds to remote machines."};
|
|
|
|
|
2017-10-24 08:52:34 +00:00
|
|
|
Setting<std::string> builders{this, "@" + nixConfDir + "/machines", "builders",
|
2017-05-02 11:44:10 +00:00
|
|
|
"A semicolon-separated list of build machines, in the format of nix.machines."};
|
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<off_t> reservedSize{this, 8 * 1024 * 1024, "gc-reserved-space",
|
|
|
|
"Amount of reserved disk space for the garbage collector."};
|
2004-01-13 16:35:43 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> fsyncMetadata{this, true, "fsync-metadata",
|
|
|
|
"Whether SQLite should use fsync()."};
|
2004-05-12 14:20:32 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> useSQLiteWAL{this, true, "use-sqlite-wal",
|
|
|
|
"Whether SQLite should use WAL mode."};
|
2010-06-23 14:34:08 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> syncBeforeRegistering{this, false, "sync-before-registering",
|
|
|
|
"Whether to call sync() before registering a path as valid."};
|
2004-10-25 14:38:23 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> useSubstitutes{this, true, "use-substitutes",
|
|
|
|
"Whether to use substitutes.",
|
|
|
|
{"build-use-substitutes"}};
|
2014-02-08 05:05:46 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<std::string> buildUsersGroup{this, "", "build-users-group",
|
|
|
|
"The Unix group that contains the build users."};
|
2014-02-19 12:05:15 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> impersonateLinux26{this, false, "impersonate-linux-26",
|
|
|
|
"Whether to impersonate a Linux 2.6 machine on newer kernels.",
|
|
|
|
{"build-impersonate-linux-26"}};
|
2011-06-30 15:19:13 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> keepLog{this, true, "keep-build-log",
|
|
|
|
"Whether to store build logs.",
|
|
|
|
{"build-keep-log"}};
|
2007-08-12 00:29:28 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> compressLog{this, true, "compress-build-log",
|
|
|
|
"Whether to compress logs.",
|
|
|
|
{"build-compress-log"}};
|
2007-11-16 16:15:26 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<unsigned long> maxLogSize{this, 0, "max-build-log-size",
|
2017-04-13 18:53:23 +00:00
|
|
|
"Maximum number of bytes a builder can write to stdout/stderr "
|
2017-08-31 12:28:25 +00:00
|
|
|
"before being killed (0 means no limit).",
|
|
|
|
{"build-max-log-size"}};
|
2013-09-02 09:58:18 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
/* When buildRepeat > 0 and verboseBuild == true, whether to print
|
|
|
|
repeated builds (i.e. builds other than the first one) to
|
2016-12-06 16:43:39 +00:00
|
|
|
stderr. Hack to prevent Hydra logs from being polluted. */
|
|
|
|
bool printRepeatedBuilds = true;
|
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<unsigned int> pollInterval{this, 5, "build-poll-interval",
|
|
|
|
"How often (in seconds) to poll for locks."};
|
2008-11-12 11:08:27 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> checkRootReachability{this, false, "gc-check-reachability",
|
|
|
|
"Whether to check if new GC roots can in fact be found by the "
|
|
|
|
"garbage collector."};
|
2008-11-12 11:08:27 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> gcKeepOutputs{this, false, "keep-outputs",
|
|
|
|
"Whether the garbage collector should keep outputs of live derivations.",
|
|
|
|
{"gc-keep-outputs"}};
|
2003-08-19 09:04:47 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> gcKeepDerivations{this, true, "keep-derivations",
|
|
|
|
"Whether the garbage collector should keep derivers of live paths.",
|
|
|
|
{"gc-keep-derivations"}};
|
2005-02-01 22:07:48 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> autoOptimiseStore{this, false, "auto-optimise-store",
|
|
|
|
"Whether to automatically replace files with identical contents with hard links."};
|
2006-02-16 13:58:10 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<bool> envKeepDerivations{this, false, "keep-env-derivations",
|
2017-04-13 18:53:23 +00:00
|
|
|
"Whether to add derivations as a dependency of user environments "
|
2017-08-31 12:28:25 +00:00
|
|
|
"(to prevent them from being GCed).",
|
|
|
|
{"env-keep-derivations"}};
|
2005-02-14 13:07:09 +00:00
|
|
|
|
2013-09-06 14:36:56 +00:00
|
|
|
/* Whether to lock the Nix client and worker to the same CPU. */
|
|
|
|
bool lockCPU;
|
|
|
|
|
2013-11-12 11:51:59 +00:00
|
|
|
/* Whether to show a stack trace if Nix evaluation fails. */
|
2017-04-13 18:53:23 +00:00
|
|
|
bool showTrace = false;
|
2013-11-12 11:51:59 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> enableNativeCode{this, false, "allow-unsafe-native-code-during-evaluation",
|
|
|
|
"Whether builtin functions that allow executing native code should be enabled."};
|
2014-06-24 14:50:03 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<SandboxMode> sandboxMode{this, smDisabled, "sandbox",
|
2017-04-13 18:53:23 +00:00
|
|
|
"Whether to enable sandboxed builds. Can be \"true\", \"false\" or \"relaxed\".",
|
2017-08-31 12:28:25 +00:00
|
|
|
{"build-use-chroot", "build-use-sandbox"}};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<PathSet> sandboxPaths{this, {}, "sandbox-paths",
|
2017-04-13 18:53:23 +00:00
|
|
|
"The paths to make available inside the build sandbox.",
|
2017-08-31 12:28:25 +00:00
|
|
|
{"build-chroot-dirs", "build-sandbox-paths"}};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<PathSet> extraSandboxPaths{this, {}, "extra-sandbox-paths",
|
2017-04-13 18:53:23 +00:00
|
|
|
"Additional paths to make available inside the build sandbox.",
|
2017-08-31 12:28:25 +00:00
|
|
|
{"build-extra-chroot-dirs", "build-extra-sandbox-paths"}};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> restrictEval{this, false, "restrict-eval",
|
|
|
|
"Whether to restrict file system access to paths in $NIX_PATH, "
|
2017-10-30 11:39:59 +00:00
|
|
|
"and network access to the URI prefixes listed in 'allowed-uris'."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-08-31 12:28:25 +00:00
|
|
|
Setting<size_t> buildRepeat{this, 0, "repeat",
|
|
|
|
"The number of times to repeat a build in order to verify determinism.",
|
|
|
|
{"build-repeat"}};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
#if __linux__
|
|
|
|
Setting<std::string> sandboxShmSize{this, "50%", "sandbox-dev-shm-size",
|
|
|
|
"The size of /dev/shm in the build sandbox."};
|
2017-05-05 15:45:22 +00:00
|
|
|
|
|
|
|
Setting<Path> sandboxBuildDir{this, "/build", "sandbox-build-dir",
|
|
|
|
"The build directory inside the sandbox."};
|
2017-04-13 18:53:23 +00:00
|
|
|
#endif
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<PathSet> allowedImpureHostPrefixes{this, {}, "allowed-impure-host-deps",
|
|
|
|
"Which prefixes to allow derivations to ask for access to (primarily for Darwin)."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
#if __APPLE__
|
|
|
|
Setting<bool> darwinLogSandboxViolations{this, false, "darwin-log-sandbox-violations",
|
|
|
|
"Whether to log Darwin sandbox access violations to the system log."};
|
|
|
|
#endif
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> runDiffHook{this, false, "run-diff-hook",
|
|
|
|
"Whether to run the program specified by the diff-hook setting "
|
|
|
|
"repeated builds produce a different result. Typically used to "
|
|
|
|
"plug in diffoscope."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
PathSetting diffHook{this, true, "", "diff-hook",
|
|
|
|
"A program that prints out the differences between the two paths "
|
|
|
|
"specified on its command line."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> enforceDeterminism{this, true, "enforce-determinism",
|
|
|
|
"Whether to fail if repeated builds produce different output."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<Strings> binaryCachePublicKeys{this,
|
|
|
|
{"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="},
|
|
|
|
"binary-cache-public-keys",
|
|
|
|
"Trusted public keys for secure substitution."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<Strings> secretKeyFiles{this, {}, "secret-key-files",
|
|
|
|
"Secret keys with which to sign local builds."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-20 12:04:00 +00:00
|
|
|
Setting<size_t> binaryCachesParallelConnections{this, 25, "http-connections",
|
|
|
|
"Number of parallel HTTP connections.",
|
|
|
|
{"binary-caches-parallel-connections"}};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-10-30 10:00:59 +00:00
|
|
|
Setting<bool> enableHttp2{this, true, "http2",
|
2017-04-13 18:53:23 +00:00
|
|
|
"Whether to enable HTTP/2 support."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<unsigned int> tarballTtl{this, 60 * 60, "tarball-ttl",
|
|
|
|
"How soon to expire files fetched by builtins.fetchTarball and builtins.fetchurl."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<std::string> signedBinaryCaches{this, "*", "signed-binary-caches",
|
|
|
|
"Obsolete."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<Strings> substituters{this,
|
|
|
|
nixStore == "/nix/store" ? Strings{"https://cache.nixos.org/"} : Strings(),
|
|
|
|
"substituters",
|
|
|
|
"The URIs of substituters (such as https://cache.nixos.org/).",
|
|
|
|
{"binary-caches"}};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
// FIXME: provide a way to add to option values.
|
|
|
|
Setting<Strings> extraSubstituters{this, {}, "extra-substituters",
|
|
|
|
"Additional URIs of substituters.",
|
|
|
|
{"extra-binary-caches"}};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-20 11:20:49 +00:00
|
|
|
Setting<StringSet> trustedSubstituters{this, {}, "trusted-substituters",
|
|
|
|
"Disabled substituters that may be enabled via the substituters option by untrusted users.",
|
|
|
|
{"trusted-binary-caches"}};
|
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<Strings> trustedUsers{this, {"root"}, "trusted-users",
|
|
|
|
"Which users or groups are trusted to ask the daemon to do unsafe things."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
|
|
|
/* ?Who we trust to use the daemon in safe ways */
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<Strings> allowedUsers{this, {"*"}, "allowed-users",
|
|
|
|
"Which users or groups are allowed to connect to the daemon."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> printMissing{this, true, "print-missing",
|
|
|
|
"Whether to print what paths need to be built or downloaded."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<std::string> preBuildHook{this,
|
|
|
|
#if __APPLE__
|
|
|
|
nixLibexecDir + "/nix/resolve-system-dependencies",
|
|
|
|
#else
|
|
|
|
"",
|
|
|
|
#endif
|
|
|
|
"pre-build-hook",
|
|
|
|
"A program to run just before a build to set derivation-specific build settings."};
|
2015-04-18 20:56:02 +00:00
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<std::string> netrcFile{this, fmt("%s/%s", nixConfDir, "netrc"), "netrc-file",
|
|
|
|
"Path to the netrc file used to obtain usernames/passwords for downloads."};
|
2017-02-16 13:46:36 +00:00
|
|
|
|
2017-03-06 19:30:35 +00:00
|
|
|
/* Path to the SSL CA file used */
|
|
|
|
Path caFile;
|
|
|
|
|
2017-04-13 18:53:23 +00:00
|
|
|
Setting<bool> enableImportFromDerivation{this, true, "allow-import-from-derivation",
|
|
|
|
"Whether the evaluator allows importing the result of a derivation."};
|
Explicitly model all settings and fail on unrecognized ones
Previously, the Settings class allowed other code to query for string
properties, which led to a proliferation of code all over the place making
up new options without any sort of central registry of valid options. This
commit pulls all those options back into the central Settings class and
removes the public get() methods, to discourage future abuses like that.
Furthermore, because we know the full set of options ahead of time, we
now fail loudly if someone enters an unrecognized option, thus preventing
subtle typos. With some template fun, we could probably also dump the full
set of options (with documentation, defaults, etc.) to the command line,
but I'm not doing that yet here.
2017-02-22 03:50:18 +00:00
|
|
|
|
2017-04-20 14:52:53 +00:00
|
|
|
CaseHackSetting useCaseHack{this, "use-case-hack",
|
2017-04-13 18:53:23 +00:00
|
|
|
"Whether to enable a Darwin-specific hack for dealing with file name collisions."};
|
2017-04-19 12:54:52 +00:00
|
|
|
|
|
|
|
Setting<unsigned long> connectTimeout{this, 0, "connect-timeout",
|
|
|
|
"Timeout for connecting to servers during downloads. 0 means use curl's builtin default."};
|
2017-05-11 13:09:09 +00:00
|
|
|
|
|
|
|
Setting<std::string> userAgentSuffix{this, "", "user-agent-suffix",
|
|
|
|
"String appended to the user agent in HTTP requests."};
|
2017-07-04 13:43:06 +00:00
|
|
|
|
|
|
|
#if __linux__
|
2017-10-12 16:21:55 +00:00
|
|
|
Setting<bool> filterSyscalls{this, true, "filter-syscalls",
|
|
|
|
"Whether to prevent certain dangerous system calls, such as "
|
|
|
|
"creation of setuid/setgid files or adding ACLs or extended "
|
|
|
|
"attributes. Only disable this if you're aware of the "
|
|
|
|
"security implications."};
|
|
|
|
|
2017-07-04 13:43:06 +00:00
|
|
|
Setting<bool> allowNewPrivileges{this, false, "allow-new-privileges",
|
|
|
|
"Whether builders can acquire new privileges by calling programs with "
|
|
|
|
"setuid/setgid bits or with file capabilities."};
|
|
|
|
#endif
|
2017-07-17 11:07:08 +00:00
|
|
|
|
|
|
|
Setting<Strings> hashedMirrors{this, {"http://tarballs.nixos.org/"}, "hashed-mirrors",
|
|
|
|
"A list of servers used by builtins.fetchurl to fetch files by hash."};
|
2017-09-05 18:43:42 +00:00
|
|
|
|
|
|
|
Setting<uint64_t> minFree{this, 0, "min-free",
|
|
|
|
"Automatically run the garbage collector when free disk space drops below the specified amount."};
|
|
|
|
|
|
|
|
Setting<uint64_t> maxFree{this, std::numeric_limits<uint64_t>::max(), "max-free",
|
|
|
|
"Stop deleting garbage when free disk space is above the specified amount."};
|
|
|
|
|
2017-10-30 11:39:59 +00:00
|
|
|
Setting<Strings> allowedUris{this, {}, "allowed-uris",
|
|
|
|
"Prefixes of URIs that builtin functions such as fetchurl and fetchGit are allowed to fetch."};
|
2012-07-30 23:55:41 +00:00
|
|
|
};
|
2008-11-20 12:25:11 +00:00
|
|
|
|
2011-11-22 17:28:41 +00:00
|
|
|
|
2012-07-30 23:55:41 +00:00
|
|
|
// FIXME: don't use a global variable.
|
|
|
|
extern Settings settings;
|
2012-07-30 20:09:54 +00:00
|
|
|
|
2011-11-22 17:28:41 +00:00
|
|
|
|
2012-11-27 12:29:55 +00:00
|
|
|
extern const string nixVersion;
|
|
|
|
|
|
|
|
|
2006-09-04 21:06:23 +00:00
|
|
|
}
|