Skip to content

Commit

Permalink
Mark experimental configuration settings programmatically
Browse files Browse the repository at this point in the history
Fix NixOS#8162

This is somewhat hard to observe until NixOS#8174 is merged, fixing the
accidental hiding of experimental features that aren't currently
enabled, but the fix is technically orthogonal.
  • Loading branch information
Ericson2314 committed Apr 10, 2023
1 parent 8f0ec32 commit b6dbd78
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
14 changes: 13 additions & 1 deletion doc/manual/utils.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ rec {
filterAttrs = pred: set:
listToAttrs (concatMap (name: let v = set.${name}; in if pred name v then [(nameValuePair name v)] else []) (attrNames set));

showSetting = { useAnchors }: name: { description, documentDefault, defaultValue, aliases, value }:
showSetting = { useAnchors }: name: { description, documentDefault, defaultValue, aliases, value, experimental-feature }:
let
result = squash ''
- ${if useAnchors
Expand All @@ -53,6 +53,18 @@ rec {
body = ''
${description}
'' + (if experimental-feature != null then ''
> **Warning**
> This is an experimental feature.
To enable it, add the following to [`nix.conf`](#):
```
extra-experimental-features = ${experimental-feature}
${name} = ...
```
'' else "") + ''
**Default:** ${showDefault documentDefault defaultValue}
${showAliases aliases}
Expand Down
20 changes: 0 additions & 20 deletions src/libstore/globals.hh
Original file line number Diff line number Diff line change
Expand Up @@ -328,16 +328,6 @@ public:
users in `build-users-group`.
UIDs are allocated starting at 872415232 (0x34000000) on Linux and 56930 on macOS.
> **Warning**
> This is an experimental feature.
To enable it, add the following to [`nix.conf`](#):
```
extra-experimental-features = auto-allocate-uids
auto-allocate-uids = true
```
)"};

Setting<uint32_t> startId{this,
Expand Down Expand Up @@ -367,16 +357,6 @@ public:
Cgroups are required and enabled automatically for derivations
that require the `uid-range` system feature.
> **Warning**
> This is an experimental feature.
To enable it, add the following to [`nix.conf`](#):
```
extra-experimental-features = cgroups
use-cgroups = true
```
)"};
#endif

Expand Down
4 changes: 4 additions & 0 deletions src/libutil/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ std::map<std::string, nlohmann::json> AbstractSetting::toJSONObject()
std::map<std::string, nlohmann::json> obj;
obj.emplace("description", description);
obj.emplace("aliases", aliases);
if (experimentalFeature)
obj.emplace("experimental-feature", *experimentalFeature);
else
obj.emplace("experimental-feature", nullptr);
return obj;
}

Expand Down

0 comments on commit b6dbd78

Please sign in to comment.