aboutsummaryrefslogtreecommitdiff
path: root/tests/recursive.sh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2021-09-15 20:33:44 +0200
committerGitHub <noreply@github.com>2021-09-15 20:33:44 +0200
commit79152e307e7eef667c3de9c21571d017654a7c32 (patch)
tree67fd413bcf0b42c5ada7eddc41a04f7bd99df3a8 /tests/recursive.sh
parent7349f257da8278af9aae35544b15c9a204e2a57b (diff)
parent3b82c1a5fef521ebadea5df12384390c8c24100c (diff)
Merge pull request #5212 from mkenigs/auto-uid-allocation
Merge master into #3600
Diffstat (limited to 'tests/recursive.sh')
-rw-r--r--tests/recursive.sh36
1 files changed, 20 insertions, 16 deletions
diff --git a/tests/recursive.sh b/tests/recursive.sh
index 2d4f83895..91518d67d 100644
--- a/tests/recursive.sh
+++ b/tests/recursive.sh
@@ -1,18 +1,20 @@
source common.sh
+sed -i 's/experimental-features .*/& recursive-nix/' "$NIX_CONF_DIR"/nix.conf
+restartDaemon
+
# FIXME
-if [[ $(uname) != Linux ]]; then exit; fi
+if [[ $(uname) != Linux ]]; then exit 99; fi
clearStore
rm -f $TEST_ROOT/result
-export unreachable=$(nix add-to-store ./recursive.sh)
+export unreachable=$(nix store add-path ./recursive.sh)
-nix --experimental-features 'nix-command recursive-nix' build -o $TEST_ROOT/result -L '(
+NIX_BIN_DIR=$(dirname $(type -p nix)) nix --extra-experimental-features 'nix-command recursive-nix' build -o $TEST_ROOT/result -L --impure --expr '
with import ./config.nix;
- with import <nix/config.nix>;
- mkDerivation {
+ mkDerivation rec {
name = "recursive";
dummy = builtins.toFile "dummy" "bla bla";
SHELL = shell;
@@ -20,12 +22,15 @@ nix --experimental-features 'nix-command recursive-nix' build -o $TEST_ROOT/resu
# Note: this is a string without context.
unreachable = builtins.getEnv "unreachable";
+ NIX_TESTS_CA_BY_DEFAULT = builtins.getEnv "NIX_TESTS_CA_BY_DEFAULT";
+
requiredSystemFeatures = [ "recursive-nix" ];
buildCommand = '\'\''
mkdir $out
- PATH=${nixBinDir}:$PATH
- opts="--experimental-features nix-command"
+ opts="--experimental-features nix-command ${if (NIX_TESTS_CA_BY_DEFAULT == "1") then "--extra-experimental-features ca-derivations" else ""}"
+
+ PATH=${builtins.getEnv "NIX_BIN_DIR"}:$PATH
# Check that we can query/build paths in our input closure.
nix $opts path-info $dummy
@@ -38,7 +43,7 @@ nix --experimental-features 'nix-command recursive-nix' build -o $TEST_ROOT/resu
# Add something to the store.
echo foobar > foobar
- foobar=$(nix $opts add-to-store ./foobar)
+ foobar=$(nix $opts store add-path ./foobar)
nix $opts path-info $foobar
nix $opts build $foobar
@@ -46,24 +51,23 @@ nix --experimental-features 'nix-command recursive-nix' build -o $TEST_ROOT/resu
# Add it to our closure.
ln -s $foobar $out/foobar
- [[ $(nix $opts path-info --all | wc -l) -eq 3 ]]
+ [[ $(nix $opts path-info --all | wc -l) -eq 4 ]]
# Build a derivation.
- nix $opts build -L '\''(
- derivation {
+ nix $opts build -L --impure --expr '\''
+ with import ${./config.nix};
+ mkDerivation {
name = "inner1";
- builder = builtins.getEnv "SHELL";
- system = builtins.getEnv "system";
+ buildCommand = "echo $fnord blaat > $out";
fnord = builtins.toFile "fnord" "fnord";
- args = [ "-c" "echo $fnord blaat > $out" ];
}
- )'\''
+ '\''
[[ $(nix $opts path-info --json ./result) =~ fnord ]]
ln -s $(nix $opts path-info ./result) $out/inner1
'\'\'';
- })
+ }
'
[[ $(cat $TEST_ROOT/result/inner1) =~ blaat ]]