| 1 | #pragma once
|
| 2 |
|
| 3 | #include "config.h"
|
| 4 | #include "types.hh"
|
| 5 |
|
| 6 | #include <map>
|
| 7 | #include <sys/types.h>
|
| 8 |
|
| 9 |
|
| 10 | namespace nix {
|
| 11 |
|
| 12 | enum CompressionType
|
| 13 | {
|
| 14 | COMPRESSION_NONE = 0,
|
| 15 | COMPRESSION_GZIP = 1
|
| 16 | #if HAVE_BZLIB_H
|
| 17 | , COMPRESSION_BZIP2 = 2
|
| 18 | #endif
|
| 19 | };
|
| 20 |
|
| 21 | struct Settings {
|
| 22 |
|
| 23 | typedef std::map<string, string> SettingsMap;
|
| 24 |
|
| 25 | Settings();
|
| 26 |
|
| 27 | void processEnvironment();
|
| 28 |
|
| 29 | void set(const string & name, const string & value);
|
| 30 |
|
| 31 | string get(const string & name, const string & def);
|
| 32 |
|
| 33 | Strings get(const string & name, const Strings & def);
|
| 34 |
|
| 35 | bool get(const string & name, bool def);
|
| 36 |
|
| 37 | int get(const string & name, int def);
|
| 38 |
|
| 39 | void update();
|
| 40 |
|
| 41 | string pack();
|
| 42 |
|
| 43 |
|
| 44 | Path nixStore;
|
| 45 |
|
| 46 |
|
| 47 | Path nixLogDir;
|
| 48 |
|
| 49 |
|
| 50 | Path nixStateDir;
|
| 51 |
|
| 52 |
|
| 53 | Path nixDBPath;
|
| 54 |
|
| 55 |
|
| 56 | Path nixConfDir;
|
| 57 |
|
| 58 |
|
| 59 | Path nixBinDir;
|
| 60 |
|
| 61 |
|
| 62 | Path nixDaemonSocketFile;
|
| 63 |
|
| 64 |
|
| 65 | Path guixProgram;
|
| 66 |
|
| 67 |
|
| 68 | bool keepFailed;
|
| 69 |
|
| 70 | |
| 71 | subgoal of the same goal) fails.
|
| 72 | bool keepGoing;
|
| 73 |
|
| 74 | |
| 75 | the owner and group of the kept temporary directories of failed
|
| 76 | builds.
|
| 77 | uid_t clientUid;
|
| 78 | gid_t clientGid;
|
| 79 |
|
| 80 | |
| 81 | to a derivation, we should try to normalise the derivation
|
| 82 | instead.
|
| 83 | bool tryFallback;
|
| 84 |
|
| 85 |
|
| 86 | Verbosity buildVerbosity;
|
| 87 |
|
| 88 |
|
| 89 | unsigned int maxBuildJobs;
|
| 90 |
|
| 91 | |
| 92 | i.e. by passing this number to Make via '-j'. 0 means that the
|
| 93 | number of actual CPU cores on the local host ought to be
|
| 94 | auto-detected.
|
| 95 | unsigned int buildCores;
|
| 96 |
|
| 97 | |
| 98 | the database.
|
| 99 | bool readOnlyMode;
|
| 100 |
|
| 101 |
|
| 102 | string thisSystem;
|
| 103 |
|
| 104 | |
| 105 | producing any output on stdout/stderr before it is killed. 0
|
| 106 | means infinity.
|
| 107 | time_t maxSilentTime;
|
| 108 |
|
| 109 | |
| 110 | means infinity.
|
| 111 | time_t buildTimeout;
|
| 112 |
|
| 113 | |
| 114 | users want to disable this from the command-line.
|
| 115 | bool useBuildHook;
|
| 116 |
|
| 117 | |
| 118 | a fixed format to allow its progress to be monitored. Each
|
| 119 | line starts with a "@". The following are defined:
|
| 120 |
|
| 121 | @ build-started <drvpath> <outpath> <system> <logfile> <pid>
|
| 122 | @ build-failed <drvpath> <outpath> <exitcode> <error text>
|
| 123 | @ build-succeeded <drvpath> <outpath>
|
| 124 | @ substituter-started <outpath> <substituter>
|
| 125 | @ substituter-failed <outpath> <exitcode> <error text>
|
| 126 | @ substituter-succeeded <outpath>
|
| 127 |
|
| 128 | Best combined with --no-build-output, otherwise stderr might
|
| 129 | conceivably contain lines in this format printed by the
|
| 130 | builders.
|
| 131 | bool printBuildTrace;
|
| 132 |
|
| 133 | |
| 134 | that clients know exactly which line comes from which builder, and
|
| 135 | which line comes from the daemon itself. The prefix for data coming
|
| 136 | from builders is "log:PID:LEN:DATA" where PID uniquely identifies the
|
| 137 | builder (PID is given in "build-started" traces.)
|
| 138 | bool multiplexedBuildOutput;
|
| 139 |
|
| 140 | |
| 141 | (/nix/var/nix/db/reserved).
|
| 142 | off_t reservedSize;
|
| 143 |
|
| 144 |
|
| 145 | bool fsyncMetadata;
|
| 146 |
|
| 147 |
|
| 148 | bool useSQLiteWAL;
|
| 149 |
|
| 150 |
|
| 151 | bool syncBeforeRegistering;
|
| 152 |
|
| 153 |
|
| 154 | bool useSubstitutes;
|
| 155 |
|
| 156 |
|
| 157 | string buildUsersGroup;
|
| 158 |
|
| 159 |
|
| 160 | bool useChroot;
|
| 161 |
|
| 162 |
|
| 163 | bool impersonateLinux26;
|
| 164 |
|
| 165 |
|
| 166 | bool keepLog;
|
| 167 |
|
| 168 |
|
| 169 | enum CompressionType logCompression;
|
| 170 |
|
| 171 | |
| 172 | before being killed (0 means no limit).
|
| 173 | unsigned long maxLogSize;
|
| 174 |
|
| 175 |
|
| 176 | bool cacheFailure;
|
| 177 |
|
| 178 |
|
| 179 | unsigned int pollInterval;
|
| 180 |
|
| 181 | |
| 182 | garbage collector.
|
| 183 | bool checkRootReachability;
|
| 184 |
|
| 185 | |
| 186 | derivations.
|
| 187 | bool gcKeepOutputs;
|
| 188 |
|
| 189 | |
| 190 | paths.
|
| 191 | bool gcKeepDerivations;
|
| 192 |
|
| 193 | |
| 194 | with hard links.
|
| 195 | bool autoOptimiseStore;
|
| 196 |
|
| 197 | |
| 198 | (to prevent them from being GCed).
|
| 199 | bool envKeepDerivations;
|
| 200 |
|
| 201 |
|
| 202 | bool lockCPU;
|
| 203 |
|
| 204 |
|
| 205 | bool showTrace;
|
| 206 |
|
| 207 | |
| 208 | loopback, for example to access a socks proxy. Note that while using
|
| 209 | "localhost" and 127.0.0.1 to access the host loopback will work, using
|
| 210 | ::1 will not, due to a limitation in Linux.
|
| 211 | bool useHostLoopback;
|
| 212 |
|
| 213 |
|
| 214 | Path slirp4netns;
|
| 215 |
|
| 216 | |
| 217 | * its use is blocked.
|
| 218 | bool allowASLR;
|
| 219 |
|
| 220 | private:
|
| 221 | SettingsMap settings;
|
| 222 |
|
| 223 | void _get(string & res, const string & name);
|
| 224 | void _get(bool & res, const string & name);
|
| 225 | void _get(StringSet & res, const string & name);
|
| 226 | void _get(Strings & res, const string & name);
|
| 227 | template<class N> void _get(N & res, const string & name);
|
| 228 | };
|
| 229 |
|
| 230 |
|
| 231 | |
| 232 | inline Settings settings;
|
| 233 |
|
| 234 |
|
| 235 | }
|