Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
globals.hh
Go to the documentation of this file.
1#pragma once
3
7
8#include <map>
9#include <limits>
10
11#include <sys/types.h>
12
13namespace nix {
14
15typedef enum { smEnabled, smRelaxed, smDisabled } SandboxMode;
16
17void to_json(JSON & j, const SandboxMode & e);
18void from_json(const JSON & j, SandboxMode & e);
19
20struct MaxBuildJobsSetting : public BaseSetting<unsigned int>
21{
22 MaxBuildJobsSetting(Config * options,
23 unsigned int def,
24 const std::string & name,
25 const std::string & description,
26 const std::set<std::string> & aliases = {},
27 const bool documentDefault = true,
28 std::optional<ExperimentalFeature> experimentalFeature = std::nullopt,
29 bool deprecated = false)
30 : BaseSetting<unsigned int>(def, true, name, description, aliases, experimentalFeature, deprecated)
31 {
32 options->addSetting(this);
33 }
34
35 unsigned int parse(const std::string & str, const ApplyConfigOptions & options) const override;
36};
37
38struct PluginFilesSetting : public BaseSetting<Paths>
39{
40 bool pluginsLoaded = false;
41
42 PluginFilesSetting(Config * options,
43 const Paths & def,
44 const std::string & name,
45 const std::string & description,
46 const std::set<std::string> & aliases = {},
47 const bool documentDefault = true,
48 std::optional<ExperimentalFeature> experimentalFeature = std::nullopt,
49 bool deprecated = false)
50 : BaseSetting<Paths>(def, true, name, description, aliases, experimentalFeature, deprecated)
51 {
52 options->addSetting(this);
53 }
54
55 Paths parse(const std::string & str, const ApplyConfigOptions & options) const override;
56};
57
58const uint32_t maxIdsPerBuild =
59 #if __linux__
60 1 << 16
61 #else
62 1
63 #endif
64 ;
65
66class Settings : public Config {
67
68 unsigned int getDefaultCores();
69
70 StringSet getDefaultSystemFeatures();
71
72 StringSet getDefaultExtraPlatforms();
73
74 bool isWSL1();
75
76 Path getDefaultSSLCertFile();
77
78public:
79
80 Settings();
81
82 Path nixPrefix;
83
88
89 Path nixDataDir; /* !!! fix */
90
95
100
105
109 std::vector<Path> nixUserConfFiles;
110
115
120
125
129 bool verboseBuild = true;
130
135 bool readOnlyMode = false;
136
137 #include "libstore-settings.gen.inc"
138};
139
140
141// FIXME: don't use a global variable.
142extern Settings settings;
143
148void initPlugins();
149
150void loadConfFile();
151
152// Used by the Settings constructor
153std::vector<Path> getUserConfigFiles();
154std::vector<Path> getHomeConfigFile();
155
156extern const std::string nixVersion;
157
161void initLibStore();
162
168void assertLibStoreInitialized();
169
170}
Definition config.hh:131
Definition globals.hh:66
std::vector< Path > nixUserConfFiles
Definition globals.hh:109
Path nixManDir
Definition globals.hh:119
Path nixStateDir
Definition globals.hh:99
bool verboseBuild
Definition globals.hh:129
bool readOnlyMode
Definition globals.hh:135
Path nixConfDir
Definition globals.hh:104
Path nixDaemonSocketFile
Definition globals.hh:124
Path nixLogDir
Definition globals.hh:94
Path nixStore
Definition globals.hh:87
Path nixBinDir
Definition globals.hh:114
Definition apply-config-options.hh:15
std::string Path
Definition types.hh:28