From f7591bc6edbedc511e5df3d9b77eb2ddc8fabab0 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 3 Nov 2024 17:22:12 -0500 Subject: [PATCH] Make `config.nix` shims As requested in https://github.com/NixOS/nix/pull/11792#discussion_r1827034428 --- .gitignore | 3 --- tests/functional/build-hook-ca-fixed.nix | 2 +- tests/functional/build-hook.nix | 2 +- tests/functional/ca/config.nix | 2 ++ tests/functional/ca/content-addressed.nix | 2 +- tests/functional/ca/nix-run.sh | 3 --- tests/functional/ca/nondeterministic.nix | 2 +- tests/functional/ca/racy.nix | 2 +- tests/functional/check-refs.nix | 2 +- tests/functional/check-reqs.nix | 2 +- tests/functional/check.nix | 2 +- tests/functional/chroot-store.sh | 3 --- tests/functional/common/functions.sh | 9 --------- tests/functional/config.nix | 2 ++ tests/functional/dependencies.nix | 2 +- tests/functional/dyn-drv/config.nix | 2 ++ tests/functional/dyn-drv/old-daemon-error-hack.nix | 2 +- tests/functional/dyn-drv/recursive-mod-json.nix | 2 +- tests/functional/dyn-drv/text-hashed-output.nix | 2 +- tests/functional/export-graph.nix | 2 +- tests/functional/extra-sandbox-profile.nix | 2 +- tests/functional/failing.nix | 2 +- tests/functional/filter-source.nix | 2 +- tests/functional/fixed.nix | 2 +- tests/functional/flakes/bundle.sh | 3 --- tests/functional/flakes/common.sh | 3 --- tests/functional/flakes/config.sh | 1 - tests/functional/flakes/develop.sh | 3 --- tests/functional/flakes/run.sh | 2 -- tests/functional/fod-failing.nix | 2 +- tests/functional/gc-concurrent.nix | 2 +- tests/functional/gc-runtime.nix | 2 +- tests/functional/hermetic.nix | 2 +- tests/functional/ifd.nix | 2 +- tests/functional/import-from-derivation.nix | 2 +- tests/functional/impure-derivations.nix | 2 +- tests/functional/impure-env.nix | 2 +- tests/functional/linux-sandbox-cert-test.nix | 2 +- tests/functional/multiple-outputs.nix | 2 +- tests/functional/nar-access.nix | 2 +- tests/functional/nix-build-examples.nix | 2 +- tests/functional/parallel.nix | 2 +- tests/functional/path.nix | 2 +- tests/functional/readfile-context.nix | 2 +- tests/functional/restricted.sh | 4 ---- tests/functional/search.nix | 2 +- tests/functional/secure-drv-outputs.nix | 2 +- tests/functional/shell-hello.nix | 2 +- tests/functional/shell.nix | 2 +- tests/functional/simple-failing.nix | 2 +- tests/functional/simple.nix | 2 +- tests/functional/structured-attrs-shell.nix | 2 +- tests/functional/structured-attrs.nix | 2 +- tests/functional/symlink-derivation.nix | 2 +- tests/functional/timeout.nix | 2 +- tests/functional/user-envs.nix | 2 +- 56 files changed, 49 insertions(+), 77 deletions(-) create mode 100644 tests/functional/ca/config.nix create mode 100644 tests/functional/config.nix create mode 100644 tests/functional/dyn-drv/config.nix diff --git a/.gitignore b/.gitignore index 11a80ab5b..de1183977 100644 --- a/.gitignore +++ b/.gitignore @@ -102,9 +102,6 @@ perl/Makefile.config /tests/functional/restricted-innocent /tests/functional/shell /tests/functional/shell.drv -/tests/functional/config.nix -/tests/functional/ca/config.nix -/tests/functional/dyn-drv/config.nix /tests/functional/repl-result-out /tests/functional/debugger-test-out /tests/functional/test-libstoreconsumer/test-libstoreconsumer diff --git a/tests/functional/build-hook-ca-fixed.nix b/tests/functional/build-hook-ca-fixed.nix index 427ec2c31..0ce6d9b12 100644 --- a/tests/functional/build-hook-ca-fixed.nix +++ b/tests/functional/build-hook-ca-fixed.nix @@ -1,6 +1,6 @@ { busybox }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let diff --git a/tests/functional/build-hook.nix b/tests/functional/build-hook.nix index 1f0e17a3b..99a13aee4 100644 --- a/tests/functional/build-hook.nix +++ b/tests/functional/build-hook.nix @@ -1,6 +1,6 @@ { busybox, contentAddressed ? false }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let diff --git a/tests/functional/ca/config.nix b/tests/functional/ca/config.nix new file mode 100644 index 000000000..451fbae4f --- /dev/null +++ b/tests/functional/ca/config.nix @@ -0,0 +1,2 @@ +# Shim to get generated file +import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/ca/config.nix" diff --git a/tests/functional/ca/content-addressed.nix b/tests/functional/ca/content-addressed.nix index 411ebb86b..2559c562f 100644 --- a/tests/functional/ca/content-addressed.nix +++ b/tests/functional/ca/content-addressed.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/ca/config.nix"; +with import ./config.nix; let mkCADerivation = args: mkDerivation ({ __contentAddressed = true; diff --git a/tests/functional/ca/nix-run.sh b/tests/functional/ca/nix-run.sh index 21c09117e..e6638cc91 100755 --- a/tests/functional/ca/nix-run.sh +++ b/tests/functional/ca/nix-run.sh @@ -6,7 +6,4 @@ flakeDir="$TEST_HOME/flake" mkdir -p "${flakeDir}" cp flake.nix "${_NIX_TEST_BUILD_DIR}/ca/config.nix" content-addressed.nix "${flakeDir}" -# `config.nix` cannot be gotten via build dir / env var (runs afoul pure eval). Instead get from flake. -removeBuildDirRef "$flakeDir"/*.nix - nix run --no-write-lock-file "path:${flakeDir}#runnable" diff --git a/tests/functional/ca/nondeterministic.nix b/tests/functional/ca/nondeterministic.nix index 740be4bd2..d6d099a3e 100644 --- a/tests/functional/ca/nondeterministic.nix +++ b/tests/functional/ca/nondeterministic.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/ca/config.nix"; +with import ./config.nix; let mkCADerivation = args: mkDerivation ({ __contentAddressed = true; diff --git a/tests/functional/ca/racy.nix b/tests/functional/ca/racy.nix index cadd98675..555a15484 100644 --- a/tests/functional/ca/racy.nix +++ b/tests/functional/ca/racy.nix @@ -2,7 +2,7 @@ # build it at once. -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/ca/config.nix"; +with import ./config.nix; mkDerivation { name = "simple"; diff --git a/tests/functional/check-refs.nix b/tests/functional/check-refs.nix index 54957f635..89690e456 100644 --- a/tests/functional/check-refs.nix +++ b/tests/functional/check-refs.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { diff --git a/tests/functional/check-reqs.nix b/tests/functional/check-reqs.nix index 4e059f5a4..41436cb48 100644 --- a/tests/functional/check-reqs.nix +++ b/tests/functional/check-reqs.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { dep1 = mkDerivation { diff --git a/tests/functional/check.nix b/tests/functional/check.nix index 13638eae8..ddab8eea9 100644 --- a/tests/functional/check.nix +++ b/tests/functional/check.nix @@ -1,6 +1,6 @@ {checkBuildId ? 0}: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; { nondeterministic = mkDerivation { diff --git a/tests/functional/chroot-store.sh b/tests/functional/chroot-store.sh index 8c2a969d3..46e91f0aa 100755 --- a/tests/functional/chroot-store.sh +++ b/tests/functional/chroot-store.sh @@ -39,9 +39,6 @@ EOF cp simple.nix shell.nix simple.builder.sh "${config_nix}" "$flakeDir/" - # `config.nix` cannot be gotten via build dir / env var (runs afoul pure eval). Instead get from flake. - removeBuildDirRef "$flakeDir"/*.nix - TODO_NixOS outPath=$(nix build --print-out-paths --no-link --sandbox-paths '/nix? /bin? /lib? /lib64? /usr?' --store "$TEST_ROOT/x" path:"$flakeDir") diff --git a/tests/functional/common/functions.sh b/tests/functional/common/functions.sh index 286bb58e8..7195149cb 100644 --- a/tests/functional/common/functions.sh +++ b/tests/functional/common/functions.sh @@ -343,15 +343,6 @@ count() { echo $# } -# Sometimes, e.g. due to pure eval, restricted eval, or sandboxing, we -# cannot look up `config.nix` in the build dir, and have to instead get -# it from the current directory. (In this case, the current directly -# will be somewhere in `$TEST_ROOT`.) -removeBuildDirRef() { - # shellcheck disable=SC2016 # The ${} in this is Nix, not shell - sed -i -e 's,"${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/[^ ]*config.nix",./config.nix,' "$@" -} - trap onError ERR fi # COMMON_FUNCTIONS_SH_SOURCED diff --git a/tests/functional/config.nix b/tests/functional/config.nix new file mode 100644 index 000000000..5d1cb74ec --- /dev/null +++ b/tests/functional/config.nix @@ -0,0 +1,2 @@ +# Shim to get generated file +import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix" diff --git a/tests/functional/dependencies.nix b/tests/functional/dependencies.nix index db06321da..be1a7ae9a 100644 --- a/tests/functional/dependencies.nix +++ b/tests/functional/dependencies.nix @@ -1,5 +1,5 @@ { hashInvalidator ? "" }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let { diff --git a/tests/functional/dyn-drv/config.nix b/tests/functional/dyn-drv/config.nix new file mode 100644 index 000000000..8ec2c67ea --- /dev/null +++ b/tests/functional/dyn-drv/config.nix @@ -0,0 +1,2 @@ +# Shim to get generated file +import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/dyn-drv/config.nix" diff --git a/tests/functional/dyn-drv/old-daemon-error-hack.nix b/tests/functional/dyn-drv/old-daemon-error-hack.nix index 7d3ccf7e4..c9d4a62d4 100644 --- a/tests/functional/dyn-drv/old-daemon-error-hack.nix +++ b/tests/functional/dyn-drv/old-daemon-error-hack.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/dyn-drv/config.nix"; +with import ./config.nix; # A simple content-addressed derivation. # The derivation can be arbitrarily modified by passing a different `seed`, diff --git a/tests/functional/dyn-drv/recursive-mod-json.nix b/tests/functional/dyn-drv/recursive-mod-json.nix index 0e778aa7f..c6a24ca4f 100644 --- a/tests/functional/dyn-drv/recursive-mod-json.nix +++ b/tests/functional/dyn-drv/recursive-mod-json.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/dyn-drv/config.nix"; +with import ./config.nix; let innerName = "foo"; in diff --git a/tests/functional/dyn-drv/text-hashed-output.nix b/tests/functional/dyn-drv/text-hashed-output.nix index aa46fff61..99203b518 100644 --- a/tests/functional/dyn-drv/text-hashed-output.nix +++ b/tests/functional/dyn-drv/text-hashed-output.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/dyn-drv/config.nix"; +with import ./config.nix; # A simple content-addressed derivation. # The derivation can be arbitrarily modified by passing a different `seed`, diff --git a/tests/functional/export-graph.nix b/tests/functional/export-graph.nix index 97ffe73a9..64fe36bd1 100644 --- a/tests/functional/export-graph.nix +++ b/tests/functional/export-graph.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { diff --git a/tests/functional/extra-sandbox-profile.nix b/tests/functional/extra-sandbox-profile.nix index 5f0e4753f..aa680b918 100644 --- a/tests/functional/extra-sandbox-profile.nix +++ b/tests/functional/extra-sandbox-profile.nix @@ -1,6 +1,6 @@ { destFile, seed }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation { name = "simple"; diff --git a/tests/functional/failing.nix b/tests/functional/failing.nix index 8b7990679..d25e2d6b6 100644 --- a/tests/functional/failing.nix +++ b/tests/functional/failing.nix @@ -1,5 +1,5 @@ { busybox }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let mkDerivation = args: diff --git a/tests/functional/filter-source.nix b/tests/functional/filter-source.nix index dcef9c4e2..907163639 100644 --- a/tests/functional/filter-source.nix +++ b/tests/functional/filter-source.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation { name = "filter"; diff --git a/tests/functional/fixed.nix b/tests/functional/fixed.nix index f70b89091..a920a2167 100644 --- a/tests/functional/fixed.nix +++ b/tests/functional/fixed.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { diff --git a/tests/functional/flakes/bundle.sh b/tests/functional/flakes/bundle.sh index 61aa040e7..2946aea35 100755 --- a/tests/functional/flakes/bundle.sh +++ b/tests/functional/flakes/bundle.sh @@ -4,9 +4,6 @@ source common.sh cp ../simple.nix ../simple.builder.sh "${config_nix}" "$TEST_HOME" -# `config.nix` cannot be gotten via build dir / env var (runs afoul pure eval). Instead get from flake. -removeBuildDirRef "$TEST_HOME"/*.nix - cd "$TEST_HOME" cat < flake.nix diff --git a/tests/functional/flakes/common.sh b/tests/functional/flakes/common.sh index 8af72f2ad..cc9b2e466 100644 --- a/tests/functional/flakes/common.sh +++ b/tests/functional/flakes/common.sh @@ -35,9 +35,6 @@ writeSimpleFlake() { EOF cp ../simple.nix ../shell.nix ../simple.builder.sh "${config_nix}" "$flakeDir/" - - # `config.nix` cannot be gotten via build dir / env var (runs afoul pure eval). Instead get from flake. - removeBuildDirRef "$flakeDir"/*.nix } createSimpleGitFlake() { diff --git a/tests/functional/flakes/config.sh b/tests/functional/flakes/config.sh index 48f1c7a85..ab2d9f47c 100755 --- a/tests/functional/flakes/config.sh +++ b/tests/functional/flakes/config.sh @@ -3,7 +3,6 @@ source common.sh cp ../simple.nix ../simple.builder.sh "${config_nix}" $TEST_HOME -removeBuildDirRef "$TEST_HOME/simple.nix" cd $TEST_HOME diff --git a/tests/functional/flakes/develop.sh b/tests/functional/flakes/develop.sh index 2e75081d4..b3e438e99 100755 --- a/tests/functional/flakes/develop.sh +++ b/tests/functional/flakes/develop.sh @@ -27,9 +27,6 @@ EOF mkdir -p "$TEST_HOME/nixpkgs" cp "${config_nix}" ../shell.nix "$TEST_HOME/nixpkgs" -# `config.nix` cannot be gotten via build dir / env var (runs afoul pure eval). Instead get from flake. -removeBuildDirRef "$TEST_HOME/nixpkgs"/*.nix - cat <"$TEST_HOME/nixpkgs/flake.nix" { outputs = {self}: { diff --git a/tests/functional/flakes/run.sh b/tests/functional/flakes/run.sh index 2077c965b..c92ddca2b 100755 --- a/tests/functional/flakes/run.sh +++ b/tests/functional/flakes/run.sh @@ -8,8 +8,6 @@ clearStore rm -rf $TEST_HOME/.cache $TEST_HOME/.config $TEST_HOME/.local cp ../shell-hello.nix "${config_nix}" $TEST_HOME -# `config.nix` cannot be gotten via build dir / env var (runs afoul pure eval). Instead get from flake. -removeBuildDirRef "$TEST_HOME"/*.nix cd $TEST_HOME cat < flake.nix diff --git a/tests/functional/fod-failing.nix b/tests/functional/fod-failing.nix index 7881a3fbf..37c04fe12 100644 --- a/tests/functional/fod-failing.nix +++ b/tests/functional/fod-failing.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { x1 = mkDerivation { name = "x1"; diff --git a/tests/functional/gc-concurrent.nix b/tests/functional/gc-concurrent.nix index a5c3c97c3..0aba1f983 100644 --- a/tests/functional/gc-concurrent.nix +++ b/tests/functional/gc-concurrent.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; { lockFifo ? null }: diff --git a/tests/functional/gc-runtime.nix b/tests/functional/gc-runtime.nix index 2603fafdf..ee5980bdf 100644 --- a/tests/functional/gc-runtime.nix +++ b/tests/functional/gc-runtime.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation { name = "gc-runtime"; diff --git a/tests/functional/hermetic.nix b/tests/functional/hermetic.nix index dafe8ad9f..d1dccdff3 100644 --- a/tests/functional/hermetic.nix +++ b/tests/functional/hermetic.nix @@ -5,7 +5,7 @@ , withFinalRefs ? false }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let contentAddressedByDefault = builtins.getEnv "NIX_TESTS_CA_BY_DEFAULT" == "1"; diff --git a/tests/functional/ifd.nix b/tests/functional/ifd.nix index c84ffbc66..d0b9b54ad 100644 --- a/tests/functional/ifd.nix +++ b/tests/functional/ifd.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; import ( mkDerivation { name = "foo"; diff --git a/tests/functional/import-from-derivation.nix b/tests/functional/import-from-derivation.nix index 8864fb30a..cc53451cf 100644 --- a/tests/functional/import-from-derivation.nix +++ b/tests/functional/import-from-derivation.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { bar = mkDerivation { diff --git a/tests/functional/impure-derivations.nix b/tests/functional/impure-derivations.nix index 04710323f..98547e6c1 100644 --- a/tests/functional/impure-derivations.nix +++ b/tests/functional/impure-derivations.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { diff --git a/tests/functional/impure-env.nix b/tests/functional/impure-env.nix index 6b9e5a825..2b0380ed7 100644 --- a/tests/functional/impure-env.nix +++ b/tests/functional/impure-env.nix @@ -1,6 +1,6 @@ { var, value }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation { name = "test"; diff --git a/tests/functional/linux-sandbox-cert-test.nix b/tests/functional/linux-sandbox-cert-test.nix index e506b6a0f..2fc083ea9 100644 --- a/tests/functional/linux-sandbox-cert-test.nix +++ b/tests/functional/linux-sandbox-cert-test.nix @@ -1,6 +1,6 @@ { mode }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation ( { diff --git a/tests/functional/multiple-outputs.nix b/tests/functional/multiple-outputs.nix index 19ae2a45d..6ba7c523d 100644 --- a/tests/functional/multiple-outputs.nix +++ b/tests/functional/multiple-outputs.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { diff --git a/tests/functional/nar-access.nix b/tests/functional/nar-access.nix index 78972bd36..9948abe59 100644 --- a/tests/functional/nar-access.nix +++ b/tests/functional/nar-access.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { a = mkDerivation { diff --git a/tests/functional/nix-build-examples.nix b/tests/functional/nix-build-examples.nix index aaea8fc07..e54dbbf62 100644 --- a/tests/functional/nix-build-examples.nix +++ b/tests/functional/nix-build-examples.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { diff --git a/tests/functional/parallel.nix b/tests/functional/parallel.nix index 1f2411c92..23f142059 100644 --- a/tests/functional/parallel.nix +++ b/tests/functional/parallel.nix @@ -1,6 +1,6 @@ {sleepTime ? 3}: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let diff --git a/tests/functional/path.nix b/tests/functional/path.nix index b23300f90..883c3c41b 100644 --- a/tests/functional/path.nix +++ b/tests/functional/path.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation { name = "filter"; diff --git a/tests/functional/readfile-context.nix b/tests/functional/readfile-context.nix index b8f4a4c27..54cd1afd9 100644 --- a/tests/functional/readfile-context.nix +++ b/tests/functional/readfile-context.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let diff --git a/tests/functional/restricted.sh b/tests/functional/restricted.sh index 63bf56cd7..00ee4ddc8 100755 --- a/tests/functional/restricted.sh +++ b/tests/functional/restricted.sh @@ -12,10 +12,6 @@ mkdir -p "$TEST_ROOT/nix" cp ./simple.nix "$TEST_ROOT/nix" cp ./simple.builder.sh "$TEST_ROOT/nix" cp "${config_nix}" "$TEST_ROOT/nix" -simple_nix="$TEST_ROOT/nix/simple.nix" -# N.B. redefine -config_nix="$TEST_ROOT/nix/config.nix" -removeBuildDirRef "${simple_nix}" cd "$TEST_ROOT/nix" nix-instantiate --restrict-eval ./simple.nix -I src=. diff --git a/tests/functional/search.nix b/tests/functional/search.nix index 3c3564bda..fea6e7a7a 100644 --- a/tests/functional/search.nix +++ b/tests/functional/search.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; { hello = mkDerivation rec { diff --git a/tests/functional/secure-drv-outputs.nix b/tests/functional/secure-drv-outputs.nix index cd111c315..b4ac8ff53 100644 --- a/tests/functional/secure-drv-outputs.nix +++ b/tests/functional/secure-drv-outputs.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; { diff --git a/tests/functional/shell-hello.nix b/tests/functional/shell-hello.nix index fa02e2bb4..c920d7cb4 100644 --- a/tests/functional/shell-hello.nix +++ b/tests/functional/shell-hello.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; rec { hello = mkDerivation { diff --git a/tests/functional/shell.nix b/tests/functional/shell.nix index f6622a487..9cae14b78 100644 --- a/tests/functional/shell.nix +++ b/tests/functional/shell.nix @@ -1,6 +1,6 @@ { inNixShell ? false, contentAddressed ? false, fooContents ? "foo" }: -let cfg = import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; in +let cfg = import ./config.nix; in with cfg; let diff --git a/tests/functional/simple-failing.nix b/tests/functional/simple-failing.nix index 228971734..d176c9c51 100644 --- a/tests/functional/simple-failing.nix +++ b/tests/functional/simple-failing.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation { name = "simple-failing"; diff --git a/tests/functional/simple.nix b/tests/functional/simple.nix index 96237695c..2035ca294 100644 --- a/tests/functional/simple.nix +++ b/tests/functional/simple.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; mkDerivation { name = "simple"; diff --git a/tests/functional/structured-attrs-shell.nix b/tests/functional/structured-attrs-shell.nix index 7ed28c03f..57c1e6bd2 100644 --- a/tests/functional/structured-attrs-shell.nix +++ b/tests/functional/structured-attrs-shell.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let dep = mkDerivation { name = "dep"; diff --git a/tests/functional/structured-attrs.nix b/tests/functional/structured-attrs.nix index ae461c21a..e93139a44 100644 --- a/tests/functional/structured-attrs.nix +++ b/tests/functional/structured-attrs.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let diff --git a/tests/functional/symlink-derivation.nix b/tests/functional/symlink-derivation.nix index 96765d355..e9a74cdce 100644 --- a/tests/functional/symlink-derivation.nix +++ b/tests/functional/symlink-derivation.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; let foo_in_store = builtins.toFile "foo" "foo"; diff --git a/tests/functional/timeout.nix b/tests/functional/timeout.nix index ad71e61e2..d0e949e31 100644 --- a/tests/functional/timeout.nix +++ b/tests/functional/timeout.nix @@ -1,4 +1,4 @@ -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; { diff --git a/tests/functional/user-envs.nix b/tests/functional/user-envs.nix index c8e846d4b..46f8b51dd 100644 --- a/tests/functional/user-envs.nix +++ b/tests/functional/user-envs.nix @@ -2,7 +2,7 @@ { foo ? "foo" }: -with import "${builtins.getEnv "_NIX_TEST_BUILD_DIR"}/config.nix"; +with import ./config.nix; assert foo == "foo";