Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
16b3e41ed0 | ||
|
|
3a490d584c | ||
|
|
b4f250417a | ||
|
|
8e2ad15cb8 | ||
|
|
b5a4e40621 | ||
|
|
e31fa17336 | ||
|
|
a646dfcdd6 |
No files matched your search
@@ -8,17 +8,19 @@ concatStrings (map
|
|||||||
let option = options.${name}; in
|
let option = options.${name}; in
|
||||||
" - `${name}` \n\n"
|
" - `${name}` \n\n"
|
||||||
+ concatStrings (map (s: " ${s}\n") (splitLines option.description)) + "\n\n"
|
+ concatStrings (map (s: " ${s}\n") (splitLines option.description)) + "\n\n"
|
||||||
+ " **Default:** " + (
|
+ (if option.documentDefault
|
||||||
if option.value == "" || option.value == []
|
then " **Default:** " + (
|
||||||
then "*empty*"
|
if option.value == "" || option.value == []
|
||||||
else if isBool option.value
|
then "*empty*"
|
||||||
then (if option.value then "`true`" else "`false`")
|
else if isBool option.value
|
||||||
else
|
then (if option.value then "`true`" else "`false`")
|
||||||
# n.b. a StringMap value type is specified as a string, but
|
else
|
||||||
# this shows the value type. The empty stringmap is "null" in
|
# n.b. a StringMap value type is specified as a string, but
|
||||||
# JSON, but that converts to "{ }" here.
|
# this shows the value type. The empty stringmap is "null" in
|
||||||
(if isAttrs option.value then "`\"\"`"
|
# JSON, but that converts to "{ }" here.
|
||||||
else "`" + toString option.value + "`")) + "\n\n"
|
(if isAttrs option.value then "`\"\"`"
|
||||||
|
else "`" + toString option.value + "`")) + "\n\n"
|
||||||
|
else " **Default:** *machine-specific*")
|
||||||
+ (if option.aliases != []
|
+ (if option.aliases != []
|
||||||
then " **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
|
then " **Deprecated alias:** " + (concatStringsSep ", " (map (s: "`${s}`") option.aliases)) + "\n\n"
|
||||||
else "")
|
else "")
|
||||||
|
|||||||
@@ -71,7 +71,6 @@
|
|||||||
- [Hacking](contributing/hacking.md)
|
- [Hacking](contributing/hacking.md)
|
||||||
- [CLI guideline](contributing/cli-guideline.md)
|
- [CLI guideline](contributing/cli-guideline.md)
|
||||||
- [Release Notes](release-notes/release-notes.md)
|
- [Release Notes](release-notes/release-notes.md)
|
||||||
- [Release X.Y (202?-??-??)](release-notes/rl-next.md)
|
|
||||||
- [Release 2.5 (2021-12-13)](release-notes/rl-2.5.md)
|
- [Release 2.5 (2021-12-13)](release-notes/rl-2.5.md)
|
||||||
- [Release 2.4 (2021-11-01)](release-notes/rl-2.4.md)
|
- [Release 2.4 (2021-11-01)](release-notes/rl-2.4.md)
|
||||||
- [Release 2.3 (2019-09-04)](release-notes/rl-2.3.md)
|
- [Release 2.3 (2019-09-04)](release-notes/rl-2.3.md)
|
||||||
|
|||||||
@@ -276,6 +276,9 @@ more than 2800 commits from 195 contributors since release 2.3.
|
|||||||
|
|
||||||
* Plugins can now register `nix` subcommands.
|
* Plugins can now register `nix` subcommands.
|
||||||
|
|
||||||
|
* The `--indirect` flag to `nix-store --add-root` has become a no-op.
|
||||||
|
`--add-root` will always generate indirect GC roots from now on.
|
||||||
|
|
||||||
## Incompatible changes
|
## Incompatible changes
|
||||||
|
|
||||||
* The `nix` command is now marked as an experimental feature. This
|
* The `nix` command is now marked as an experimental feature. This
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
then ""
|
then ""
|
||||||
else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}";
|
else "pre${builtins.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}_${self.shortRev or "dirty"}";
|
||||||
|
|
||||||
officialRelease = false;
|
officialRelease = true;
|
||||||
|
|
||||||
linux64BitSystems = [ "x86_64-linux" "aarch64-linux" ];
|
linux64BitSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||||
linuxSystems = linux64BitSystems ++ [ "i686-linux" ];
|
linuxSystems = linux64BitSystems ++ [ "i686-linux" ];
|
||||||
|
|||||||
@@ -544,13 +544,7 @@ struct curlFileTransfer : public FileTransfer
|
|||||||
stopWorkerThread();
|
stopWorkerThread();
|
||||||
});
|
});
|
||||||
|
|
||||||
#ifdef __linux__
|
unshareFilesystem();
|
||||||
/* Cause this thread to not share any FS attributes with the main thread,
|
|
||||||
because this causes setns() in restoreMountNamespace() to fail.
|
|
||||||
Ideally, this would happen in the std::thread() constructor. */
|
|
||||||
if (unshare(CLONE_FS) != 0)
|
|
||||||
throw SysError("unsharing filesystem state in download thread");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::map<CURL *, std::shared_ptr<TransferItem>> items;
|
std::map<CURL *, std::shared_ptr<TransferItem>> items;
|
||||||
|
|
||||||
|
|||||||
+10
-7
@@ -21,7 +21,7 @@ struct MaxBuildJobsSetting : public BaseSetting<unsigned int>
|
|||||||
const std::string & name,
|
const std::string & name,
|
||||||
const std::string & description,
|
const std::string & description,
|
||||||
const std::set<std::string> & aliases = {})
|
const std::set<std::string> & aliases = {})
|
||||||
: BaseSetting<unsigned int>(def, name, description, aliases)
|
: BaseSetting<unsigned int>(def, true, name, description, aliases)
|
||||||
{
|
{
|
||||||
options->addSetting(this);
|
options->addSetting(this);
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ struct PluginFilesSetting : public BaseSetting<Paths>
|
|||||||
const std::string & name,
|
const std::string & name,
|
||||||
const std::string & description,
|
const std::string & description,
|
||||||
const std::set<std::string> & aliases = {})
|
const std::set<std::string> & aliases = {})
|
||||||
: BaseSetting<Paths>(def, name, description, aliases)
|
: BaseSetting<Paths>(def, true, name, description, aliases)
|
||||||
{
|
{
|
||||||
options->addSetting(this);
|
options->addSetting(this);
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,9 @@ public:
|
|||||||
{"build-max-jobs"}};
|
{"build-max-jobs"}};
|
||||||
|
|
||||||
Setting<unsigned int> buildCores{
|
Setting<unsigned int> buildCores{
|
||||||
this, getDefaultCores(), "cores",
|
this,
|
||||||
|
getDefaultCores(),
|
||||||
|
"cores",
|
||||||
R"(
|
R"(
|
||||||
Sets the value of the `NIX_BUILD_CORES` environment variable in the
|
Sets the value of the `NIX_BUILD_CORES` environment variable in the
|
||||||
invocation of builders. Builders can use this variable at their
|
invocation of builders. Builders can use this variable at their
|
||||||
@@ -141,7 +143,7 @@ public:
|
|||||||
command line switch and defaults to `1`. The value `0` means that
|
command line switch and defaults to `1`. The value `0` means that
|
||||||
the builder should use all available CPU cores in the system.
|
the builder should use all available CPU cores in the system.
|
||||||
)",
|
)",
|
||||||
{"build-cores"}};
|
{"build-cores"}, false};
|
||||||
|
|
||||||
/* Read-only mode. Don't copy stuff to the store, don't change
|
/* Read-only mode. Don't copy stuff to the store, don't change
|
||||||
the database. */
|
the database. */
|
||||||
@@ -583,10 +585,11 @@ public:
|
|||||||
platform and generate incompatible code, so you may wish to
|
platform and generate incompatible code, so you may wish to
|
||||||
cross-check the results of using this option against proper
|
cross-check the results of using this option against proper
|
||||||
natively-built versions of your derivations.
|
natively-built versions of your derivations.
|
||||||
)"};
|
)", {}, false};
|
||||||
|
|
||||||
Setting<StringSet> systemFeatures{
|
Setting<StringSet> systemFeatures{
|
||||||
this, getDefaultSystemFeatures(),
|
this,
|
||||||
|
getDefaultSystemFeatures(),
|
||||||
"system-features",
|
"system-features",
|
||||||
R"(
|
R"(
|
||||||
A set of system “features” supported by this machine, e.g. `kvm`.
|
A set of system “features” supported by this machine, e.g. `kvm`.
|
||||||
@@ -602,7 +605,7 @@ public:
|
|||||||
This setting by default includes `kvm` if `/dev/kvm` is accessible,
|
This setting by default includes `kvm` if `/dev/kvm` is accessible,
|
||||||
and the pseudo-features `nixos-test`, `benchmark` and `big-parallel`
|
and the pseudo-features `nixos-test`, `benchmark` and `big-parallel`
|
||||||
that are used in Nixpkgs to route builds to specific machines.
|
that are used in Nixpkgs to route builds to specific machines.
|
||||||
)"};
|
)", {}, false};
|
||||||
|
|
||||||
Setting<Strings> substituters{
|
Setting<Strings> substituters{
|
||||||
this,
|
this,
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ std::map<std::string, nlohmann::json> BaseSetting<T>::toJSONObject()
|
|||||||
auto obj = AbstractSetting::toJSONObject();
|
auto obj = AbstractSetting::toJSONObject();
|
||||||
obj.emplace("value", value);
|
obj.emplace("value", value);
|
||||||
obj.emplace("defaultValue", defaultValue);
|
obj.emplace("defaultValue", defaultValue);
|
||||||
|
obj.emplace("documentDefault", documentDefault);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -232,16 +232,19 @@ protected:
|
|||||||
|
|
||||||
T value;
|
T value;
|
||||||
const T defaultValue;
|
const T defaultValue;
|
||||||
|
const bool documentDefault;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
BaseSetting(const T & def,
|
BaseSetting(const T & def,
|
||||||
|
const bool documentDefault,
|
||||||
const std::string & name,
|
const std::string & name,
|
||||||
const std::string & description,
|
const std::string & description,
|
||||||
const std::set<std::string> & aliases = {})
|
const std::set<std::string> & aliases = {})
|
||||||
: AbstractSetting(name, description, aliases)
|
: AbstractSetting(name, description, aliases)
|
||||||
, value(def)
|
, value(def)
|
||||||
, defaultValue(def)
|
, defaultValue(def)
|
||||||
|
, documentDefault(documentDefault)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
operator const T &() const { return value; }
|
operator const T &() const { return value; }
|
||||||
@@ -288,8 +291,9 @@ public:
|
|||||||
const T & def,
|
const T & def,
|
||||||
const std::string & name,
|
const std::string & name,
|
||||||
const std::string & description,
|
const std::string & description,
|
||||||
const std::set<std::string> & aliases = {})
|
const std::set<std::string> & aliases = {},
|
||||||
: BaseSetting<T>(def, name, description, aliases)
|
const bool documentDefault = true)
|
||||||
|
: BaseSetting<T>(def, documentDefault, name, description, aliases)
|
||||||
{
|
{
|
||||||
options->addSetting(this);
|
options->addSetting(this);
|
||||||
}
|
}
|
||||||
@@ -311,7 +315,7 @@ public:
|
|||||||
const std::string & name,
|
const std::string & name,
|
||||||
const std::string & description,
|
const std::string & description,
|
||||||
const std::set<std::string> & aliases = {})
|
const std::set<std::string> & aliases = {})
|
||||||
: BaseSetting<Path>(def, name, description, aliases)
|
: BaseSetting<Path>(def, true, name, description, aliases)
|
||||||
, allowEmpty(allowEmpty)
|
, allowEmpty(allowEmpty)
|
||||||
{
|
{
|
||||||
options->addSetting(this);
|
options->addSetting(this);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace nix {
|
|||||||
Setting<std::string> setting{&config, "", "name-of-the-setting", "description"};
|
Setting<std::string> setting{&config, "", "name-of-the-setting", "description"};
|
||||||
setting.assign("value");
|
setting.assign("value");
|
||||||
|
|
||||||
ASSERT_EQ(config.toJSON().dump(), R"#({"name-of-the-setting":{"aliases":[],"defaultValue":"","description":"description\n","value":"value"}})#");
|
ASSERT_EQ(config.toJSON().dump(), R"#({"name-of-the-setting":{"aliases":[],"defaultValue":"","description":"description\n","documentDefault":true,"value":"value"}})#");
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Config, setSettingAlias) {
|
TEST(Config, setSettingAlias) {
|
||||||
|
|||||||
@@ -1660,6 +1660,14 @@ void restoreMountNamespace()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void unshareFilesystem()
|
||||||
|
{
|
||||||
|
#ifdef __linux__
|
||||||
|
if (unshare(CLONE_FS) != 0 && errno != EPERM)
|
||||||
|
throw SysError("unsharing filesystem state in download thread");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void restoreProcessContext(bool restoreMounts)
|
void restoreProcessContext(bool restoreMounts)
|
||||||
{
|
{
|
||||||
restoreSignals();
|
restoreSignals();
|
||||||
|
|||||||
@@ -311,6 +311,11 @@ void saveMountNamespace();
|
|||||||
if saveMountNamespace() was never called. */
|
if saveMountNamespace() was never called. */
|
||||||
void restoreMountNamespace();
|
void restoreMountNamespace();
|
||||||
|
|
||||||
|
/* Cause this thread to not share any FS attributes with the main
|
||||||
|
thread, because this causes setns() in restoreMountNamespace() to
|
||||||
|
fail. */
|
||||||
|
void unshareFilesystem();
|
||||||
|
|
||||||
|
|
||||||
class ExecError : public Error
|
class ExecError : public Error
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user