mirror of
https://github.com/NixOS/nix
synced 2025-07-01 20:51:48 +02:00
Merge pull request #30 from DeterminateSystems/stable-nix-command
Remove the `nix-command` experimental feature
This commit is contained in:
commit
bbd2c17f58
37 changed files with 41 additions and 121 deletions
|
@ -36,11 +36,6 @@ let
|
||||||
let
|
let
|
||||||
|
|
||||||
result = ''
|
result = ''
|
||||||
> **Warning** \
|
|
||||||
> This program is
|
|
||||||
> [**experimental**](@docroot@/contributing/experimental-features.md#xp-feature-nix-command)
|
|
||||||
> and its interface is subject to change.
|
|
||||||
|
|
||||||
# Name
|
# Name
|
||||||
|
|
||||||
`${command}` - ${details.description}
|
`${command}` - ${details.description}
|
||||||
|
|
|
@ -35,7 +35,7 @@ dummy-env = env -i \
|
||||||
NIX_STATE_DIR=/dummy \
|
NIX_STATE_DIR=/dummy \
|
||||||
NIX_CONFIG='cores = 0'
|
NIX_CONFIG='cores = 0'
|
||||||
|
|
||||||
nix-eval = $(dummy-env) $(doc_nix) eval --experimental-features nix-command -I nix=doc/manual --store dummy:// --impure --raw
|
nix-eval = $(dummy-env) $(doc_nix) eval -I nix=doc/manual --store dummy:// --impure --raw
|
||||||
|
|
||||||
# re-implement mdBook's include directive to make it usable for terminal output and for proper @docroot@ substitution
|
# re-implement mdBook's include directive to make it usable for terminal output and for proper @docroot@ substitution
|
||||||
define process-includes
|
define process-includes
|
||||||
|
@ -121,7 +121,7 @@ $(d)/nix.json: $(doc_nix)
|
||||||
@mv $@.tmp $@
|
@mv $@.tmp $@
|
||||||
|
|
||||||
$(d)/conf-file.json: $(doc_nix)
|
$(d)/conf-file.json: $(doc_nix)
|
||||||
$(trace-gen) $(dummy-env) $(doc_nix) config show --json --experimental-features nix-command > $@.tmp
|
$(trace-gen) $(dummy-env) $(doc_nix) config show --json > $@.tmp
|
||||||
@mv $@.tmp $@
|
@mv $@.tmp $@
|
||||||
|
|
||||||
$(d)/src/contributing/experimental-feature-descriptions.md: $(d)/xp-features.json $(d)/utils.nix $(d)/generate-xp-features.nix $(doc_nix)
|
$(d)/src/contributing/experimental-feature-descriptions.md: $(d)/xp-features.json $(d)/utils.nix $(d)/generate-xp-features.nix $(doc_nix)
|
||||||
|
|
|
@ -14,11 +14,6 @@ The following instructions assume you already have some version of Nix installed
|
||||||
|
|
||||||
## Building Nix with flakes
|
## Building Nix with flakes
|
||||||
|
|
||||||
This section assumes you are using Nix with the experimental feature [`nix-command`] enabled.
|
|
||||||
See the [Building Nix](#building-nix) section for equivalent instructions using stable Nix interfaces.
|
|
||||||
|
|
||||||
[`nix-command`]: @docroot@/contributing/experimental-features.md#xp-nix-command
|
|
||||||
|
|
||||||
To build all dependencies and start a shell in which all environment variables are set up so that those dependencies can be found:
|
To build all dependencies and start a shell in which all environment variables are set up so that those dependencies can be found:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
|
@ -105,7 +100,7 @@ nix (Nix) 2.12
|
||||||
To build a release version of Nix for the current operating system and CPU architecture:
|
To build a release version of Nix for the current operating system and CPU architecture:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix-build
|
$ nix build
|
||||||
```
|
```
|
||||||
|
|
||||||
You can also build Nix for one of the [supported platforms](#platforms).
|
You can also build Nix for one of the [supported platforms](#platforms).
|
||||||
|
@ -155,12 +150,6 @@ platform. Common solutions include [remote build machines] and [binary format em
|
||||||
Given such a setup, executing the build only requires selecting the respective attribute.
|
Given such a setup, executing the build only requires selecting the respective attribute.
|
||||||
For example, to compile for `aarch64-linux`:
|
For example, to compile for `aarch64-linux`:
|
||||||
|
|
||||||
```console
|
|
||||||
$ nix-build --attr packages.aarch64-linux.default
|
|
||||||
```
|
|
||||||
|
|
||||||
or for Nix with the [`flakes`] and [`nix-command`] experimental features enabled:
|
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nix build .#packages.aarch64-linux.default
|
$ nix build .#packages.aarch64-linux.default
|
||||||
```
|
```
|
||||||
|
@ -242,20 +231,12 @@ To build with one of those environments, you can use
|
||||||
$ nix build .#nix-ccacheStdenv
|
$ nix build .#nix-ccacheStdenv
|
||||||
```
|
```
|
||||||
|
|
||||||
for flake-enabled Nix, or
|
|
||||||
|
|
||||||
```console
|
|
||||||
$ nix-build --attr nix-ccacheStdenv
|
|
||||||
```
|
|
||||||
|
|
||||||
for classic Nix.
|
|
||||||
|
|
||||||
You can use any of the other supported environments in place of `nix-ccacheStdenv`.
|
You can use any of the other supported environments in place of `nix-ccacheStdenv`.
|
||||||
|
|
||||||
## Editor integration
|
## Editor integration
|
||||||
|
|
||||||
The `clangd` LSP server is installed by default on the `clang`-based `devShell`s.
|
The `clangd` LSP server is installed by default on the `clang`-based `devShell`s.
|
||||||
See [supported compilation environments](#compilation-environments) and instructions how to set up a shell [with flakes](#nix-with-flakes) or in [classic Nix](#classic-nix).
|
See [supported compilation environments](#compilation-environments) and instructions how to [set up a shell with flakes](#nix-with-flakes).
|
||||||
|
|
||||||
To use the LSP with your editor, you first need to [set up `clangd`](https://clangd.llvm.org/installation#project-setup) by running:
|
To use the LSP with your editor, you first need to [set up `clangd`](https://clangd.llvm.org/installation#project-setup) by running:
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# Derivation JSON Format
|
# Derivation JSON Format
|
||||||
|
|
||||||
> **Warning**
|
|
||||||
>
|
|
||||||
> This JSON format is currently
|
|
||||||
> [**experimental**](@docroot@/contributing/experimental-features.md#xp-feature-nix-command)
|
|
||||||
> and subject to change.
|
|
||||||
|
|
||||||
The JSON serialization of a
|
The JSON serialization of a
|
||||||
[derivations](@docroot@/glossary.md#gloss-store-derivation)
|
[derivations](@docroot@/glossary.md#gloss-store-derivation)
|
||||||
is a JSON object with the following fields:
|
is a JSON object with the following fields:
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
# Store object info JSON format
|
# Store object info JSON format
|
||||||
|
|
||||||
> **Warning**
|
|
||||||
>
|
|
||||||
> This JSON format is currently
|
|
||||||
> [**experimental**](@docroot@/contributing/experimental-features.md#xp-feature-nix-command)
|
|
||||||
> and subject to change.
|
|
||||||
|
|
||||||
Info about a [store object].
|
Info about a [store object].
|
||||||
|
|
||||||
* `path`:
|
* `path`:
|
||||||
|
|
|
@ -25,7 +25,7 @@ runCommand "installer-script" {
|
||||||
(tarball: let
|
(tarball: let
|
||||||
inherit (tarball.stdenv.hostPlatform) system;
|
inherit (tarball.stdenv.hostPlatform) system;
|
||||||
in '' \
|
in '' \
|
||||||
--replace '@tarballHash_${system}@' $(nix --experimental-features nix-command hash-file --base16 --type sha256 ${tarball}/*.tar.xz) \
|
--replace '@tarballHash_${system}@' $(nix hash-file --base16 --type sha256 ${tarball}/*.tar.xz) \
|
||||||
--replace '@tarballPath_${system}@' $(tarballPath ${tarball}/*.tar.xz) \
|
--replace '@tarballPath_${system}@' $(tarballPath ${tarball}/*.tar.xz) \
|
||||||
''
|
''
|
||||||
)
|
)
|
||||||
|
|
|
@ -988,9 +988,7 @@ Goal::Co DerivationGoal::buildDone()
|
||||||
msg += line;
|
msg += line;
|
||||||
msg += "\n";
|
msg += "\n";
|
||||||
}
|
}
|
||||||
auto nixLogCommand = experimentalFeatureSettings.isEnabled(Xp::NixCommand)
|
auto nixLogCommand = "nix log";
|
||||||
? "nix log"
|
|
||||||
: "nix-store -l";
|
|
||||||
msg += fmt("For full logs, run '" ANSI_BOLD "%s %s" ANSI_NORMAL "'.",
|
msg += fmt("For full logs, run '" ANSI_BOLD "%s %s" ANSI_NORMAL "'.",
|
||||||
nixLogCommand,
|
nixLogCommand,
|
||||||
worker.store.printStorePath(drvPath));
|
worker.store.printStorePath(drvPath));
|
||||||
|
|
|
@ -582,7 +582,7 @@ Strings argvToStrings(int argc, char * * argv)
|
||||||
|
|
||||||
std::optional<ExperimentalFeature> Command::experimentalFeature ()
|
std::optional<ExperimentalFeature> Command::experimentalFeature ()
|
||||||
{
|
{
|
||||||
return { Xp::NixCommand };
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
MultiCommand::MultiCommand(std::string_view commandName, const Commands & commands_)
|
MultiCommand::MultiCommand(std::string_view commandName, const Commands & commands_)
|
||||||
|
|
|
@ -386,7 +386,7 @@ struct ExperimentalFeatureSettings : Config {
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```
|
```
|
||||||
experimental-features = nix-command
|
experimental-features = ca-derivations
|
||||||
```
|
```
|
||||||
|
|
||||||
The following experimental features are available:
|
The following experimental features are available:
|
||||||
|
|
|
@ -86,15 +86,6 @@ constexpr std::array<ExperimentalFeatureDetails, numXpFeatures> xpFeatureDetails
|
||||||
)",
|
)",
|
||||||
.trackingUrl = "https://github.com/NixOS/nix/milestone/31",
|
.trackingUrl = "https://github.com/NixOS/nix/milestone/31",
|
||||||
},
|
},
|
||||||
{
|
|
||||||
.tag = Xp::NixCommand,
|
|
||||||
.name = "nix-command",
|
|
||||||
.description = R"(
|
|
||||||
Enable the new `nix` subcommands. See the manual on
|
|
||||||
[`nix`](@docroot@/command-ref/new-cli/nix.md) for details.
|
|
||||||
)",
|
|
||||||
.trackingUrl = "https://github.com/NixOS/nix/milestone/28",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.tag = Xp::GitHashing,
|
.tag = Xp::GitHashing,
|
||||||
.name = "git-hashing",
|
.name = "git-hashing",
|
||||||
|
@ -302,7 +293,7 @@ static_assert(
|
||||||
* A set of previously experimental features that are now considered
|
* A set of previously experimental features that are now considered
|
||||||
* stable. We don't warn if users have these in `experimental-features`.
|
* stable. We don't warn if users have these in `experimental-features`.
|
||||||
*/
|
*/
|
||||||
std::set<std::string> stabilizedFeatures{"flakes"};
|
std::set<std::string> stabilizedFeatures{"flakes", "nix-command"};
|
||||||
|
|
||||||
const std::optional<ExperimentalFeature> parseExperimentalFeature(const std::string_view & name)
|
const std::optional<ExperimentalFeature> parseExperimentalFeature(const std::string_view & name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,7 +19,6 @@ enum struct ExperimentalFeature
|
||||||
CaDerivations,
|
CaDerivations,
|
||||||
ImpureDerivations,
|
ImpureDerivations,
|
||||||
FetchTree,
|
FetchTree,
|
||||||
NixCommand,
|
|
||||||
GitHashing,
|
GitHashing,
|
||||||
RecursiveNix,
|
RecursiveNix,
|
||||||
NoUrlLiterals,
|
NoUrlLiterals,
|
||||||
|
|
|
@ -122,7 +122,6 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
|
||||||
.description = "Print full build logs on standard error.",
|
.description = "Print full build logs on standard error.",
|
||||||
.category = loggingCategory,
|
.category = loggingCategory,
|
||||||
.handler = {[&]() { logger->setPrintBuildLogs(true); }},
|
.handler = {[&]() { logger->setPrintBuildLogs(true); }},
|
||||||
.experimentalFeature = Xp::NixCommand,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
addFlag({
|
addFlag({
|
||||||
|
@ -138,7 +137,6 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
|
||||||
.description = "Disable substituters and consider all previously downloaded files up-to-date.",
|
.description = "Disable substituters and consider all previously downloaded files up-to-date.",
|
||||||
.category = miscCategory,
|
.category = miscCategory,
|
||||||
.handler = {[&]() { useNet = false; }},
|
.handler = {[&]() { useNet = false; }},
|
||||||
.experimentalFeature = Xp::NixCommand,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
addFlag({
|
addFlag({
|
||||||
|
@ -146,7 +144,6 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs, virtual RootArgs
|
||||||
.description = "Consider all previously downloaded files out-of-date.",
|
.description = "Consider all previously downloaded files out-of-date.",
|
||||||
.category = miscCategory,
|
.category = miscCategory,
|
||||||
.handler = {[&]() { refresh = true; }},
|
.handler = {[&]() { refresh = true; }},
|
||||||
.experimentalFeature = Xp::NixCommand,
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,6 @@ manual](https://nixos.org/manual/nix/stable/).
|
||||||
|
|
||||||
# Installables
|
# Installables
|
||||||
|
|
||||||
> **Warning** \
|
|
||||||
> Installables are part of the unstable
|
|
||||||
> [`nix-command` experimental feature](@docroot@/contributing/experimental-features.md#xp-feature-nix-command),
|
|
||||||
> and subject to change without notice.
|
|
||||||
|
|
||||||
Many `nix` subcommands operate on one or more *installables*.
|
Many `nix` subcommands operate on one or more *installables*.
|
||||||
These are command line arguments that represent something that can be realised in the Nix store.
|
These are command line arguments that represent something that can be realised in the Nix store.
|
||||||
|
|
||||||
|
@ -68,11 +63,6 @@ That is, Nix will operate on the default flake output attribute of the flake in
|
||||||
|
|
||||||
### Flake output attribute
|
### Flake output attribute
|
||||||
|
|
||||||
> **Warning** \
|
|
||||||
> Flake output attribute installables depend on the
|
|
||||||
> [`nix-command`](@docroot@/contributing/experimental-features.md#xp-feature-nix-command)
|
|
||||||
> experimental feature, and subject to change without notice.
|
|
||||||
|
|
||||||
Example: `nixpkgs#hello`
|
Example: `nixpkgs#hello`
|
||||||
|
|
||||||
These have the form *flakeref*[`#`*attrpath*], where *flakeref* is a
|
These have the form *flakeref*[`#`*attrpath*], where *flakeref* is a
|
||||||
|
|
|
@ -19,7 +19,7 @@ drvPath3=$(nix derivation add --dry-run < "$TEST_HOME"/foo.json)
|
||||||
[[ ! -e "$drvPath3" ]]
|
[[ ! -e "$drvPath3" ]]
|
||||||
|
|
||||||
# But the JSON is rejected without the experimental feature
|
# But the JSON is rejected without the experimental feature
|
||||||
expectStderr 1 nix derivation add < "$TEST_HOME"/foo.json --experimental-features nix-command | grepQuiet "experimental Nix feature 'ca-derivations' is disabled"
|
expectStderr 1 nix derivation add < "$TEST_HOME"/foo.json --experimental-features '' | grepQuiet "experimental Nix feature 'ca-derivations' is disabled"
|
||||||
|
|
||||||
# Without --dry-run it is actually written
|
# Without --dry-run it is actually written
|
||||||
drvPath4=$(nix derivation add < "$TEST_HOME"/foo.json)
|
drvPath4=$(nix derivation add < "$TEST_HOME"/foo.json)
|
||||||
|
|
|
@ -4,7 +4,7 @@ source common.sh
|
||||||
|
|
||||||
requireDaemonNewerThan "2.4pre20210626"
|
requireDaemonNewerThan "2.4pre20210626"
|
||||||
|
|
||||||
enableFeatures "ca-derivations nix-command"
|
enableFeatures "ca-derivations"
|
||||||
|
|
||||||
export NIX_TESTS_CA_BY_DEFAULT=1
|
export NIX_TESTS_CA_BY_DEFAULT=1
|
||||||
cd ..
|
cd ..
|
||||||
|
|
|
@ -12,7 +12,6 @@ if isTestOnNixOS; then
|
||||||
! test -e "$test_nix_conf"
|
! test -e "$test_nix_conf"
|
||||||
cat > "$test_nix_conf_dir/nix.conf" <<EOF
|
cat > "$test_nix_conf_dir/nix.conf" <<EOF
|
||||||
# TODO: this is not needed for all tests and prevents stable commands from be tested in isolation
|
# TODO: this is not needed for all tests and prevents stable commands from be tested in isolation
|
||||||
experimental-features = nix-command
|
|
||||||
flake-registry = $TEST_ROOT/registry.json
|
flake-registry = $TEST_ROOT/registry.json
|
||||||
show-trace = true
|
show-trace = true
|
||||||
EOF
|
EOF
|
||||||
|
@ -47,7 +46,7 @@ cat > "$NIX_CONF_DIR"/nix.conf <<EOF
|
||||||
build-users-group =
|
build-users-group =
|
||||||
keep-derivations = false
|
keep-derivations = false
|
||||||
sandbox = false
|
sandbox = false
|
||||||
experimental-features = nix-command
|
experimental-features =
|
||||||
gc-reserved-space = 0
|
gc-reserved-space = 0
|
||||||
substituters =
|
substituters =
|
||||||
flake-registry = $TEST_ROOT/registry.json
|
flake-registry = $TEST_ROOT/registry.json
|
||||||
|
|
|
@ -123,7 +123,8 @@ startDaemon() {
|
||||||
fi
|
fi
|
||||||
# Start the daemon, wait for the socket to appear.
|
# Start the daemon, wait for the socket to appear.
|
||||||
rm -f $NIX_DAEMON_SOCKET_PATH
|
rm -f $NIX_DAEMON_SOCKET_PATH
|
||||||
PATH=$DAEMON_PATH nix --extra-experimental-features 'nix-command' daemon &
|
# TODO: remove the nix-command feature when we're no longer testing against old daemons.
|
||||||
|
PATH=$DAEMON_PATH nix daemon --extra-experimental-features nix-command &
|
||||||
_NIX_TEST_DAEMON_PID=$!
|
_NIX_TEST_DAEMON_PID=$!
|
||||||
export _NIX_TEST_DAEMON_PID
|
export _NIX_TEST_DAEMON_PID
|
||||||
for ((i = 0; i < 300; i++)); do
|
for ((i = 0; i < 300; i++)); do
|
||||||
|
|
|
@ -54,12 +54,12 @@ var=$(nix config show | grep '^allowed-uris =' | cut -d '=' -f 2 | xargs)
|
||||||
|
|
||||||
# Test that we can !include a file.
|
# Test that we can !include a file.
|
||||||
export NIX_USER_CONF_FILES=$here/config/nix-with-bang-include.conf
|
export NIX_USER_CONF_FILES=$here/config/nix-with-bang-include.conf
|
||||||
var=$(nix config show | grep '^experimental-features =' | cut -d '=' -f 2 | xargs)
|
var=$(nix config show | grep '^fsync-metadata =' | cut -d '=' -f 2 | xargs)
|
||||||
[[ $var == nix-command ]]
|
[[ $var == true ]]
|
||||||
|
|
||||||
# Test that it's possible to load config from the environment
|
# Test that it's possible to load config from the environment
|
||||||
prev=$(nix config show | grep '^cores' | cut -d '=' -f 2 | xargs)
|
prev=$(nix config show | grep '^cores' | cut -d '=' -f 2 | xargs)
|
||||||
export NIX_CONFIG="cores = 4242"$'\n'"experimental-features = nix-command"
|
export NIX_CONFIG="cores = 4242"$'\n'
|
||||||
exp_cores=$(nix config show | grep '^cores' | cut -d '=' -f 2 | xargs)
|
exp_cores=$(nix config show | grep '^cores' | cut -d '=' -f 2 | xargs)
|
||||||
exp_features=$(nix config show | grep '^experimental-features' | cut -d '=' -f 2 | xargs)
|
exp_features=$(nix config show | grep '^experimental-features' | cut -d '=' -f 2 | xargs)
|
||||||
[[ $prev != $exp_cores ]]
|
[[ $prev != $exp_cores ]]
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
experimental-features = nix-command
|
fsync-metadata = true
|
||||||
!include ./missing-extra-config.conf
|
!include ./missing-extra-config.conf
|
|
@ -1,2 +1 @@
|
||||||
experimental-features = nix-command
|
|
||||||
include ./extra-config.conf
|
include ./extra-config.conf
|
|
@ -1,2 +1 @@
|
||||||
experimental-features = nix-command
|
|
||||||
substituters = https://example.com
|
substituters = https://example.com
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
source ./common.sh
|
source ./common.sh
|
||||||
|
|
||||||
# Without the dynamic-derivations XP feature, we don't have the builtin.
|
# Without the dynamic-derivations XP feature, we don't have the builtin.
|
||||||
nix --experimental-features 'nix-command' eval --impure --expr \
|
nix --experimental-features '' eval --impure --expr \
|
||||||
'assert ! (builtins ? outputOf); ""'
|
'assert ! (builtins ? outputOf); ""'
|
||||||
|
|
||||||
# Test that a string is required.
|
# Test that a string is required.
|
||||||
|
@ -12,14 +12,14 @@ nix --experimental-features 'nix-command' eval --impure --expr \
|
||||||
# object that could be coerced to a string. We might liberalise this in
|
# object that could be coerced to a string. We might liberalise this in
|
||||||
# the future so it does work, but there are some design questions to
|
# the future so it does work, but there are some design questions to
|
||||||
# resolve first. Adding a test so we don't liberalise it by accident.
|
# resolve first. Adding a test so we don't liberalise it by accident.
|
||||||
expectStderr 1 nix --experimental-features 'nix-command dynamic-derivations' eval --impure --expr \
|
expectStderr 1 nix --experimental-features 'dynamic-derivations' eval --impure --expr \
|
||||||
'builtins.outputOf (import ../dependencies.nix {}) "out"' \
|
'builtins.outputOf (import ../dependencies.nix {}) "out"' \
|
||||||
| grepQuiet "expected a string but found a set"
|
| grepQuiet "expected a string but found a set"
|
||||||
|
|
||||||
# Test that "DrvDeep" string contexts are not supported at this time
|
# Test that "DrvDeep" string contexts are not supported at this time
|
||||||
#
|
#
|
||||||
# Like the above, this is a restriction we could relax later.
|
# Like the above, this is a restriction we could relax later.
|
||||||
expectStderr 1 nix --experimental-features 'nix-command dynamic-derivations' eval --impure --expr \
|
expectStderr 1 nix --experimental-features 'dynamic-derivations' eval --impure --expr \
|
||||||
'builtins.outputOf (import ../dependencies.nix {}).drvPath "out"' \
|
'builtins.outputOf (import ../dependencies.nix {}).drvPath "out"' \
|
||||||
| grepQuiet "has a context which refers to a complete source and binary closure. This is not supported at this time"
|
| grepQuiet "has a context which refers to a complete source and binary closure. This is not supported at this time"
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ mkDerivation rec {
|
||||||
drv = builtins.unsafeDiscardOutputDependency (import ./text-hashed-output.nix).hello.drvPath;
|
drv = builtins.unsafeDiscardOutputDependency (import ./text-hashed-output.nix).hello.drvPath;
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
export NIX_CONFIG='experimental-features = nix-command ca-derivations'
|
export NIX_CONFIG='experimental-features = ca-derivations'
|
||||||
|
|
||||||
PATH=${builtins.getEnv "EXTRA_PATH"}:$PATH
|
PATH=${builtins.getEnv "EXTRA_PATH"}:$PATH
|
||||||
|
|
||||||
|
|
|
@ -11,12 +11,12 @@ source common.sh
|
||||||
# # With flakes, flake options should show up
|
# # With flakes, flake options should show up
|
||||||
#
|
#
|
||||||
# function grep_both_ways {
|
# function grep_both_ways {
|
||||||
# nix --experimental-features 'nix-command' "$@" | grepQuietInverse flake
|
# nix --experimental-features '' "$@" | grepQuietInverse flake
|
||||||
# nix --experimental-features 'nix-command' "$@" | grepQuiet flake
|
# nix --experimental-features '' "$@" | grepQuiet flake
|
||||||
#
|
#
|
||||||
# # Also, the order should not matter
|
# # Also, the order should not matter
|
||||||
# nix "$@" --experimental-features 'nix-command' | grepQuietInverse flake
|
# nix "$@" --experimental-features '' | grepQuietInverse flake
|
||||||
# nix "$@" --experimental-features 'nix-command' | grepQuiet flake
|
# nix "$@" --experimental-features '' | grepQuiet flake
|
||||||
# }
|
# }
|
||||||
#
|
#
|
||||||
# # Simple case, the configuration effects the running command
|
# # Simple case, the configuration effects the running command
|
||||||
|
@ -34,7 +34,7 @@ gatedSetting=auto-allocate-uids
|
||||||
|
|
||||||
# Experimental feature is disabled before, ignore and warn.
|
# Experimental feature is disabled before, ignore and warn.
|
||||||
NIX_CONFIG="
|
NIX_CONFIG="
|
||||||
experimental-features = nix-command
|
experimental-features =
|
||||||
$gatedSetting = true
|
$gatedSetting = true
|
||||||
" expect 1 nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
" expect 1 nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
||||||
[[ $(cat "$TEST_ROOT/stdout") = '' ]]
|
[[ $(cat "$TEST_ROOT/stdout") = '' ]]
|
||||||
|
@ -43,14 +43,14 @@ grepQuiet "error: could not find setting '$gatedSetting'" "$TEST_ROOT/stderr"
|
||||||
# Experimental feature is disabled after, ignore and warn.
|
# Experimental feature is disabled after, ignore and warn.
|
||||||
NIX_CONFIG="
|
NIX_CONFIG="
|
||||||
$gatedSetting = true
|
$gatedSetting = true
|
||||||
experimental-features = nix-command
|
experimental-features =
|
||||||
" expect 1 nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
" expect 1 nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
||||||
[[ $(cat "$TEST_ROOT/stdout") = '' ]]
|
[[ $(cat "$TEST_ROOT/stdout") = '' ]]
|
||||||
grepQuiet "error: could not find setting '$gatedSetting'" "$TEST_ROOT/stderr"
|
grepQuiet "error: could not find setting '$gatedSetting'" "$TEST_ROOT/stderr"
|
||||||
|
|
||||||
# Experimental feature is enabled before, process.
|
# Experimental feature is enabled before, process.
|
||||||
NIX_CONFIG="
|
NIX_CONFIG="
|
||||||
experimental-features = nix-command $xpFeature
|
experimental-features = $xpFeature
|
||||||
$gatedSetting = true
|
$gatedSetting = true
|
||||||
" nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
" nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
||||||
grepQuiet "true" "$TEST_ROOT/stdout"
|
grepQuiet "true" "$TEST_ROOT/stdout"
|
||||||
|
@ -58,18 +58,18 @@ grepQuiet "true" "$TEST_ROOT/stdout"
|
||||||
# Experimental feature is enabled after, process.
|
# Experimental feature is enabled after, process.
|
||||||
NIX_CONFIG="
|
NIX_CONFIG="
|
||||||
$gatedSetting = true
|
$gatedSetting = true
|
||||||
experimental-features = nix-command $xpFeature
|
experimental-features = $xpFeature
|
||||||
" nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
" nix config show $gatedSetting 1>"$TEST_ROOT"/stdout 2>"$TEST_ROOT"/stderr
|
||||||
grepQuiet "true" "$TEST_ROOT/stdout"
|
grepQuiet "true" "$TEST_ROOT/stdout"
|
||||||
grepQuietInverse "Ignoring setting '$gatedSetting'" "$TEST_ROOT/stderr"
|
grepQuietInverse "Ignoring setting '$gatedSetting'" "$TEST_ROOT/stderr"
|
||||||
|
|
||||||
function exit_code_both_ways {
|
function exit_code_both_ways {
|
||||||
expect 1 nix --experimental-features 'nix-command ' "$@" 1>/dev/null
|
expect 1 nix --experimental-features '' "$@" 1>/dev/null
|
||||||
nix --experimental-features "nix-command $xpFeature" "$@" 1>/dev/null
|
nix --experimental-features "$xpFeature" "$@" 1>/dev/null
|
||||||
|
|
||||||
# Also, the order should not matter
|
# Also, the order should not matter
|
||||||
expect 1 nix "$@" --experimental-features 'nix-command' 1>/dev/null
|
expect 1 nix "$@" --experimental-features '' 1>/dev/null
|
||||||
nix "$@" --experimental-features "nix-command $xpFeature" 1>/dev/null
|
nix "$@" --experimental-features "$xpFeature" 1>/dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
exit_code_both_ways config show --auto-allocate-uids
|
exit_code_both_ways config show --auto-allocate-uids
|
||||||
|
@ -79,12 +79,3 @@ nix --experimental-features '' --help 1>/dev/null
|
||||||
nix --experimental-features '' doctor --help 1>/dev/null
|
nix --experimental-features '' doctor --help 1>/dev/null
|
||||||
nix --experimental-features '' repl --help 1>/dev/null
|
nix --experimental-features '' repl --help 1>/dev/null
|
||||||
nix --experimental-features '' upgrade-nix --help 1>/dev/null
|
nix --experimental-features '' upgrade-nix --help 1>/dev/null
|
||||||
|
|
||||||
# These 3 arguments are currently given to all commands, which is wrong (as not
|
|
||||||
# all care). To deal with fixing later, we simply make them require the
|
|
||||||
# nix-command experimental features --- it so happens that the commands we wish
|
|
||||||
# stabilizing to do not need them anyways.
|
|
||||||
for arg in '--print-build-logs' '--offline' '--refresh'; do
|
|
||||||
nix --experimental-features 'nix-command' "$arg" --help 1>/dev/null
|
|
||||||
expect 1 nix --experimental-features '' "$arg" --help 1>/dev/null
|
|
||||||
done
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ drvPath2=$(nix derivation add < $TEST_HOME/impure-drv.json)
|
||||||
[[ "$drvPath" = "$drvPath2" ]]
|
[[ "$drvPath" = "$drvPath2" ]]
|
||||||
|
|
||||||
# But only with the experimental feature!
|
# But only with the experimental feature!
|
||||||
expectStderr 1 nix derivation add < $TEST_HOME/impure-drv.json --experimental-features nix-command | grepQuiet "experimental Nix feature 'impure-derivations' is disabled"
|
expectStderr 1 nix derivation add < $TEST_HOME/impure-drv.json --experimental-features '' | grepQuiet "experimental Nix feature 'impure-derivations' is disabled"
|
||||||
|
|
||||||
nix build --dry-run --json --file ./impure-derivations.nix impure.all
|
nix build --dry-run --json --file ./impure-derivations.nix impure.all
|
||||||
json=$(nix build -L --no-link --json --file ./impure-derivations.nix impure.all)
|
json=$(nix build -L --no-link --json --file ./impure-derivations.nix impure.all)
|
||||||
|
|
|
@ -14,7 +14,7 @@ mkDerivation rec {
|
||||||
|
|
||||||
buildCommand = ''
|
buildCommand = ''
|
||||||
mkdir $out
|
mkdir $out
|
||||||
opts="--experimental-features nix-command ${if (NIX_TESTS_CA_BY_DEFAULT == "1") then "--extra-experimental-features ca-derivations" else ""}"
|
opts="${if (NIX_TESTS_CA_BY_DEFAULT == "1") then "--extra-experimental-features ca-derivations" else ""}"
|
||||||
|
|
||||||
PATH=${builtins.getEnv "NIX_BIN_DIR"}:$PATH
|
PATH=${builtins.getEnv "NIX_BIN_DIR"}:$PATH
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ rm -f $TEST_ROOT/result
|
||||||
|
|
||||||
export unreachable=$(nix store add-path ./recursive.sh)
|
export unreachable=$(nix store add-path ./recursive.sh)
|
||||||
|
|
||||||
NIX_BIN_DIR=$(dirname $(type -p nix)) nix --extra-experimental-features 'nix-command recursive-nix' build -o $TEST_ROOT/result -L --impure --file ./recursive.nix
|
NIX_BIN_DIR=$(dirname $(type -p nix)) nix --extra-experimental-features 'recursive-nix' build -o $TEST_ROOT/result -L --impure --file ./recursive.nix
|
||||||
|
|
||||||
[[ $(cat $TEST_ROOT/result/inner1) =~ blaat ]]
|
[[ $(cat $TEST_ROOT/result/inner1) =~ blaat ]]
|
||||||
|
|
||||||
|
|
|
@ -224,7 +224,7 @@ let
|
||||||
source /etc/bashrc || true
|
source /etc/bashrc || true
|
||||||
|
|
||||||
nix-env --version
|
nix-env --version
|
||||||
nix --extra-experimental-features nix-command store info
|
nix store info
|
||||||
|
|
||||||
out=\$(nix-build --no-substitute -E 'derivation { name = "foo"; system = "x86_64-linux"; builder = "/bin/sh"; args = ["-c" "echo foobar > \$out"]; }')
|
out=\$(nix-build --no-substitute -E 'derivation { name = "foo"; system = "x86_64-linux"; builder = "/bin/sh"; args = ["-c" "echo foobar > \$out"]; }')
|
||||||
[[ \$(cat \$out) = foobar ]]
|
[[ \$(cat \$out) = foobar ]]
|
||||||
|
|
|
@ -10,8 +10,6 @@
|
||||||
users.users.alice.isNormalUser = true;
|
users.users.alice.isNormalUser = true;
|
||||||
users.users.bob.isNormalUser = true;
|
users.users.bob.isNormalUser = true;
|
||||||
users.users.mallory.isNormalUser = true;
|
users.users.mallory.isNormalUser = true;
|
||||||
|
|
||||||
nix.settings.experimental-features = "nix-command";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript =
|
testScript =
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
nix.settings.substituters = lib.mkForce [ ];
|
nix.settings.substituters = lib.mkForce [ ];
|
||||||
nix.extraOptions =
|
nix.extraOptions =
|
||||||
''
|
''
|
||||||
extra-experimental-features = nix-command auto-allocate-uids cgroups
|
extra-experimental-features = auto-allocate-uids cgroups
|
||||||
extra-system-features = uid-range
|
extra-system-features = uid-range
|
||||||
'';
|
'';
|
||||||
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
nix.nixPath = [ "nixpkgs=${nixpkgs}" ];
|
||||||
|
|
|
@ -74,7 +74,6 @@ in
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
_NIX_FORCE_HTTP = "1";
|
_NIX_FORCE_HTTP = "1";
|
||||||
};
|
};
|
||||||
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
||||||
};
|
};
|
||||||
setupScript = ''
|
setupScript = ''
|
||||||
'';
|
'';
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
{
|
{
|
||||||
programs.ssh.extraConfig = "ConnectTimeout 30";
|
programs.ssh.extraConfig = "ConnectTimeout 30";
|
||||||
environment.systemPackages = [ pkgs.git ];
|
environment.systemPackages = [ pkgs.git ];
|
||||||
nix.extraOptions = "experimental-features = nix-command flakes";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,6 @@ in
|
||||||
virtualisation.additionalPaths = [ pkgs.hello pkgs.fuse ];
|
virtualisation.additionalPaths = [ pkgs.hello pkgs.fuse ];
|
||||||
virtualisation.memorySize = 4096;
|
virtualisation.memorySize = 4096;
|
||||||
nix.settings.substituters = lib.mkForce [ ];
|
nix.settings.substituters = lib.mkForce [ ];
|
||||||
nix.extraOptions = "experimental-features = nix-command";
|
|
||||||
networking.hosts.${(builtins.head nodes.github.networking.interfaces.eth1.ipv4.addresses).address} =
|
networking.hosts.${(builtins.head nodes.github.networking.interfaces.eth1.ipv4.addresses).address} =
|
||||||
[ "channels.nixos.org" "api.github.com" "github.com" ];
|
[ "channels.nixos.org" "api.github.com" "github.com" ];
|
||||||
security.pki.certificateFiles = [ "${cert}/ca.crt" ];
|
security.pki.certificateFiles = [ "${cert}/ca.crt" ];
|
||||||
|
|
|
@ -23,7 +23,6 @@ in {
|
||||||
{ virtualisation.writableStore = true;
|
{ virtualisation.writableStore = true;
|
||||||
virtualisation.additionalPaths = [ pkgA pkgD.drvPath ];
|
virtualisation.additionalPaths = [ pkgA pkgD.drvPath ];
|
||||||
nix.settings.substituters = lib.mkForce [ ];
|
nix.settings.substituters = lib.mkForce [ ];
|
||||||
nix.settings.experimental-features = [ "nix-command" ];
|
|
||||||
services.getty.autologinUser = "root";
|
services.getty.autologinUser = "root";
|
||||||
programs.ssh.extraConfig = ''
|
programs.ssh.extraConfig = ''
|
||||||
Host *
|
Host *
|
||||||
|
|
|
@ -104,7 +104,6 @@ in
|
||||||
virtualisation.memorySize = 4096;
|
virtualisation.memorySize = 4096;
|
||||||
nix.settings.substituters = lib.mkForce [ ];
|
nix.settings.substituters = lib.mkForce [ ];
|
||||||
nix.extraOptions = ''
|
nix.extraOptions = ''
|
||||||
experimental-features = nix-command
|
|
||||||
flake-registry = https://git.sr.ht/~NixOS/flake-registry/blob/master/flake-registry.json
|
flake-registry = https://git.sr.ht/~NixOS/flake-registry/blob/master/flake-registry.json
|
||||||
'';
|
'';
|
||||||
environment.systemPackages = [ pkgs.jq ];
|
environment.systemPackages = [ pkgs.jq ];
|
||||||
|
|
|
@ -51,7 +51,6 @@ in
|
||||||
virtualisation.additionalPaths = [ pkgs.hello pkgs.fuse ];
|
virtualisation.additionalPaths = [ pkgs.hello pkgs.fuse ];
|
||||||
virtualisation.memorySize = 4096;
|
virtualisation.memorySize = 4096;
|
||||||
nix.settings.substituters = lib.mkForce [ ];
|
nix.settings.substituters = lib.mkForce [ ];
|
||||||
nix.extraOptions = "experimental-features = nix-command";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ runCommand "repl-completion" {
|
||||||
];
|
];
|
||||||
expectScript = ''
|
expectScript = ''
|
||||||
# Regression https://github.com/NixOS/nix/pull/10778
|
# Regression https://github.com/NixOS/nix/pull/10778
|
||||||
spawn nix repl --offline --extra-experimental-features nix-command
|
spawn nix repl --offline
|
||||||
expect "nix-repl>"
|
expect "nix-repl>"
|
||||||
send "foo = import ./does-not-exist.nix\n"
|
send "foo = import ./does-not-exist.nix\n"
|
||||||
expect "nix-repl>"
|
expect "nix-repl>"
|
||||||
|
@ -37,4 +37,4 @@ runCommand "repl-completion" {
|
||||||
nix-store --init
|
nix-store --init
|
||||||
expect $expectScriptPath
|
expect $expectScriptPath
|
||||||
touch $out
|
touch $out
|
||||||
''
|
''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue