Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nix
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 389a2cebed7c
Choose a base ref
...
head repository: NixOS/nix
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: aabf5c86c9df
Choose a head ref
  • 1 commit
  • 4 files changed
  • 1 contributor

Commits on Oct 21, 2019

  1. Add experimental-features setting

    Experimental features are now opt-in. There is currently one
    experimental feature: "nix-command" (which enables the "nix"
    command. This will allow us to merge experimental features more
    quickly, without committing to supporting them indefinitely.
    
    Typical usage:
    
    $ nix build --experimental-features 'nix-command flakes' nixpkgs#hello
    
    (cherry picked from commit 8e478c2,
    without the "flakes" feature)
    edolstra committed Oct 21, 2019
    2

    Verified

    This commit was signed with the committer’s verified signature.
    edolstra Eelco Dolstra
    Copy the full SHA
    aabf5c8 View commit details
Showing with 15 additions and 0 deletions.
  1. +7 −0 src/libstore/globals.cc
  2. +5 −0 src/libstore/globals.hh
  3. +2 −0 src/nix/main.cc
  4. +1 −0 tests/init.sh
7 changes: 7 additions & 0 deletions src/libstore/globals.cc
Original file line number Diff line number Diff line change
@@ -105,6 +105,13 @@ StringSet Settings::getDefaultSystemFeatures()
return features;
}

void Settings::requireExperimentalFeature(const std::string & name)
{
auto & f = experimentalFeatures.get();
if (std::find(f.begin(), f.end(), name) == f.end())
throw Error("experimental Nix feature '%s' is disabled", name);
}

const string nixVersion = PACKAGE_VERSION;

template<> void BaseSetting<SandboxMode>::set(const std::string & str)
5 changes: 5 additions & 0 deletions src/libstore/globals.hh
Original file line number Diff line number Diff line change
@@ -353,6 +353,11 @@ public:

Setting<Paths> pluginFiles{this, {}, "plugin-files",
"Plugins to dynamically load at nix initialization time."};

Setting<Strings> experimentalFeatures{this, {}, "experimental-features",
"Experimental Nix features to enable."};

void requireExperimentalFeature(const std::string & name);
};


2 changes: 2 additions & 0 deletions src/nix/main.cc
Original file line number Diff line number Diff line change
@@ -138,6 +138,8 @@ void mainWrapped(int argc, char * * argv)

args.parseCmdline(argvToStrings(argc, argv));

settings.requireExperimentalFeature("nix-command");

initPlugins();

if (!args.command) args.showHelpAndExit();
1 change: 1 addition & 0 deletions tests/init.sh
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ cat > "$NIX_CONF_DIR"/nix.conf <<EOF
build-users-group =
keep-derivations = false
sandbox = false
experimental-features = nix-command
include nix.conf.extra
EOF