123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244 |
- #pragma once
- #include "config.h"
- #include "types.hh"
- #include <map>
- #include <sys/types.h>
- namespace nix {
- enum CompressionType
- {
- COMPRESSION_NONE = 0,
- COMPRESSION_GZIP = 1
- #if HAVE_BZLIB_H
- , COMPRESSION_BZIP2 = 2
- #endif
- };
- struct Settings {
- typedef std::map<string, string> SettingsMap;
- Settings();
- void processEnvironment();
- void loadConfFile();
- void set(const string & name, const string & value);
- string get(const string & name, const string & def);
- Strings get(const string & name, const Strings & def);
- bool get(const string & name, bool def);
- int get(const string & name, int def);
- void update();
- string pack();
- void unpack(const string & pack);
- SettingsMap getOverrides();
-
- Path nixStore;
- Path nixDataDir;
-
- Path nixLogDir;
-
- Path nixStateDir;
-
- Path nixDBPath;
-
- Path nixConfDir;
-
- Path nixLibexecDir;
-
- Path nixBinDir;
-
- Path nixDaemonSocketFile;
-
- bool keepFailed;
-
- bool keepGoing;
-
- uid_t clientUid;
- gid_t clientGid;
-
- bool tryFallback;
-
- Verbosity buildVerbosity;
-
- unsigned int maxBuildJobs;
-
- unsigned int buildCores;
-
- bool readOnlyMode;
-
- string thisSystem;
-
- time_t maxSilentTime;
-
- time_t buildTimeout;
-
- Paths substituters;
-
- bool useBuildHook;
-
- bool printBuildTrace;
-
- off_t reservedSize;
-
- bool fsyncMetadata;
-
- bool useSQLiteWAL;
-
- bool syncBeforeRegistering;
-
- bool useSubstitutes;
-
- string buildUsersGroup;
-
- bool useChroot;
-
- Strings sshSubstituterHosts;
-
- bool useSshSubstituter;
-
- bool impersonateLinux26;
-
- bool keepLog;
-
- enum CompressionType logCompression;
-
- unsigned long maxLogSize;
-
- bool cacheFailure;
-
- unsigned int pollInterval;
-
- bool checkRootReachability;
-
- bool gcKeepOutputs;
-
- bool gcKeepDerivations;
-
- bool autoOptimiseStore;
-
- bool envKeepDerivations;
-
- bool lockCPU;
-
- bool showTrace;
-
- Strings logServers;
-
- bool enableImportNative;
- private:
- SettingsMap settings, overrides;
- void _get(string & res, const string & name);
- void _get(bool & res, const string & name);
- void _get(StringSet & res, const string & name);
- void _get(Strings & res, const string & name);
- template<class N> void _get(N & res, const string & name);
- };
- extern Settings settings;
- extern const string nixVersion;
- }
|