aboutsummaryrefslogtreecommitdiff
path: root/tests/nix_path.sh
diff options
context:
space:
mode:
authorregnat <rg@regnat.ovh>2022-01-27 15:32:14 +0100
committerregnat <rg@regnat.ovh>2022-01-27 16:26:39 +0100
commitfcdc60ed227ba28f0d0d160d17df27fe179138b0 (patch)
tree1a2a634502c23fcb9f89282e41aaa2aaab489d00 /tests/nix_path.sh
parent1fe3bfdeaf7c57e9f7044a22edfbdf6fb9629e9d (diff)
Don’t require `NIX_PATH` entries to be valid paths
It’s totally valid to have entries in `NIX_PATH` that aren’t valid paths (they can even be arbitrary urls or `channel:<channel-name>`). Fix #5998 and #5980
Diffstat (limited to 'tests/nix_path.sh')
-rw-r--r--tests/nix_path.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/nix_path.sh b/tests/nix_path.sh
new file mode 100644
index 000000000..d3657abf0
--- /dev/null
+++ b/tests/nix_path.sh
@@ -0,0 +1,11 @@
+# Regression for https://github.com/NixOS/nix/issues/5998 and https://github.com/NixOS/nix/issues/5980
+
+source common.sh
+
+export NIX_PATH=non-existent=/non-existent/but-unused-anyways:by-absolute-path=$PWD:by-relative-path=.
+
+nix-instantiate --eval -E '<by-absolute-path/simple.nix>' --restrict-eval
+nix-instantiate --eval -E '<by-relative-path/simple.nix>' --restrict-eval
+
+# Should ideally also test this, but there’s no pure way to do it, so just trust me that it works
+# nix-instantiate --eval -E '<nixpkgs>' -I nixpkgs=channel:nixos-unstable --restrict-eval