2012-07-18 20:59:03 +02:00
|
|
|
#pragma once
|
2003-06-16 15:33:38 +02:00
|
|
|
|
2006-09-04 23:06:23 +02:00
|
|
|
#include "types.hh"
|
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
#include <map>
|
|
|
|
|
2006-09-04 23:06:23 +02:00
|
|
|
|
|
|
|
namespace nix {
|
2003-06-16 15:33:38 +02:00
|
|
|
|
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
struct Settings {
|
|
|
|
|
2012-08-01 00:19:44 +02:00
|
|
|
typedef std::map<string, string> SettingsMap;
|
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
Settings();
|
|
|
|
|
|
|
|
void processEnvironment();
|
|
|
|
|
|
|
|
void loadConfFile();
|
|
|
|
|
|
|
|
void set(const string & name, const string & value);
|
|
|
|
|
|
|
|
void update();
|
|
|
|
|
|
|
|
string pack();
|
|
|
|
|
2012-08-01 00:19:44 +02:00
|
|
|
SettingsMap getOverrides();
|
|
|
|
|
2012-07-31 01:55:41 +02: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 we keep the SQLite database. */
|
|
|
|
Path nixDBPath;
|
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
|
|
|
/* Whether to keep temporary directories of failed builds. */
|
|
|
|
bool keepFailed;
|
|
|
|
|
|
|
|
/* Whether to keep building subgoals when a sibling (another
|
|
|
|
subgoal of the same goal) fails. */
|
|
|
|
bool keepGoing;
|
|
|
|
|
|
|
|
/* Whether, if we cannot realise the known closure corresponding
|
|
|
|
to a derivation, we should try to normalise the derivation
|
|
|
|
instead. */
|
|
|
|
bool tryFallback;
|
|
|
|
|
|
|
|
/* Verbosity level for build output. */
|
|
|
|
Verbosity buildVerbosity;
|
2003-06-16 15:33:38 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Maximum number of parallel build jobs. 0 means unlimited. */
|
|
|
|
unsigned int maxBuildJobs;
|
2003-06-16 15:33:38 +02:00
|
|
|
|
2012-07-31 01:55:41 +02: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
|
|
|
|
auto-detected. */
|
|
|
|
unsigned int buildCores;
|
2003-07-10 15:41:28 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Read-only mode. Don't copy stuff to the store, don't change
|
|
|
|
the database. */
|
|
|
|
bool readOnlyMode;
|
2003-06-16 15:33:38 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* The canonical system name, as returned by config.guess. */
|
|
|
|
string thisSystem;
|
2003-11-19 18:27:16 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* The maximum time in seconds that a builer can go without
|
|
|
|
producing any output on stdout/stderr before it is killed. 0
|
|
|
|
means infinity. */
|
|
|
|
time_t maxSilentTime;
|
2003-07-31 15:47:13 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* The maximum duration in seconds that a builder can run. 0
|
|
|
|
means infinity. */
|
|
|
|
time_t buildTimeout;
|
2005-02-01 23:07:48 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* The substituters. There are programs that can somehow realise
|
|
|
|
a store path without building, e.g., by downloading it or
|
|
|
|
copying it from a CD. */
|
|
|
|
Paths substituters;
|
2006-07-20 15:21:37 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to use build hooks (for distributed builds). Sometimes
|
|
|
|
users want to disable this from the command-line. */
|
|
|
|
bool useBuildHook;
|
2006-12-04 14:09:16 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether buildDerivations() should print out lines on stderr in
|
|
|
|
a fixed format to allow its progress to be monitored. Each
|
|
|
|
line starts with a "@". The following are defined:
|
2005-02-01 23:07:48 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
@ build-started <drvpath> <outpath> <system> <logfile>
|
|
|
|
@ build-failed <drvpath> <outpath> <exitcode> <error text>
|
|
|
|
@ build-succeeded <drvpath> <outpath>
|
|
|
|
@ substituter-started <outpath> <substituter>
|
|
|
|
@ substituter-failed <outpath> <exitcode> <error text>
|
|
|
|
@ substituter-succeeded <outpath>
|
2003-08-19 11:04:47 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
Best combined with --no-build-output, otherwise stderr might
|
|
|
|
conceivably contain lines in this format printed by the
|
|
|
|
builders. */
|
|
|
|
bool printBuildTrace;
|
2003-08-19 11:04:47 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Amount of reserved space for the garbage collector
|
|
|
|
(/nix/var/nix/db/reserved). */
|
|
|
|
off_t reservedSize;
|
2004-06-25 17:36:09 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether SQLite should use fsync. */
|
|
|
|
bool fsyncMetadata;
|
2004-06-28 12:42:57 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether SQLite should use WAL mode. */
|
|
|
|
bool useSQLiteWAL;
|
2004-01-13 17:35:43 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to call sync() before registering a path as valid. */
|
|
|
|
bool syncBeforeRegistering;
|
2004-05-12 16:20:32 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to use substitutes. */
|
|
|
|
bool useSubstitutes;
|
2010-06-23 16:34:08 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* The Unix group that contains the build users. */
|
|
|
|
string buildUsersGroup;
|
2004-10-25 16:38:23 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to build in chroot. */
|
|
|
|
bool useChroot;
|
2006-07-06 17:30:37 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* The directories from the host filesystem to be included in the
|
|
|
|
chroot. */
|
|
|
|
PathSet dirsInChroot;
|
2006-12-08 16:44:00 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to impersonate a Linux 2.6 machine on newer kernels. */
|
|
|
|
bool impersonateLinux26;
|
2011-06-30 17:19:13 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to store build logs. */
|
|
|
|
bool keepLog;
|
2007-08-12 02:29:28 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to compress logs. */
|
|
|
|
bool compressLog;
|
2007-11-16 17:15:26 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to cache build failures. */
|
|
|
|
bool cacheFailure;
|
2008-11-12 12:08:27 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* How often (in seconds) to poll for locks. */
|
|
|
|
unsigned int pollInterval;
|
2008-11-12 12:08:27 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to check if new GC roots can in fact be found by the
|
|
|
|
garbage collector. */
|
|
|
|
bool checkRootReachability;
|
2008-11-12 12:08:27 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether the garbage collector should keep outputs of live
|
|
|
|
derivations. */
|
|
|
|
bool gcKeepOutputs;
|
2003-08-19 11:04:47 +02:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether the garbage collector should keep derivers of live
|
|
|
|
paths. */
|
|
|
|
bool gcKeepDerivations;
|
2005-02-01 23:07:48 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to automatically replace files with identical contents
|
|
|
|
with hard links. */
|
|
|
|
bool autoOptimiseStore;
|
2006-02-16 14:58:10 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
/* Whether to add derivations as a dependency of user environments
|
|
|
|
(to prevent them from being GCed). */
|
|
|
|
bool envKeepDerivations;
|
2005-02-14 14:07:09 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
private:
|
2012-08-01 00:19:44 +02:00
|
|
|
SettingsMap settings, overrides;
|
2009-02-27 12:04:41 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
void get(string & res, const string & name);
|
|
|
|
void get(bool & res, const string & name);
|
|
|
|
void get(PathSet & res, const string & name);
|
|
|
|
template<class N> void get(N & res, const string & name);
|
|
|
|
};
|
2008-11-20 13:25:11 +01:00
|
|
|
|
2011-11-22 18:28:41 +01:00
|
|
|
|
2012-07-31 01:55:41 +02:00
|
|
|
// FIXME: don't use a global variable.
|
|
|
|
extern Settings settings;
|
2012-07-30 22:09:54 +02:00
|
|
|
|
2011-11-22 18:28:41 +01:00
|
|
|
|
2006-09-04 23:06:23 +02:00
|
|
|
}
|