mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Merge 1f032a98c5
into 918ac6b2fc
This commit is contained in:
commit
45f6d3d3b8
3 changed files with 15 additions and 1 deletions
|
@ -103,7 +103,7 @@ void initGC()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// NIX_PATH must override the regular setting
|
// NIX_PATH must override the regular setting
|
||||||
// See the comment in applyConfig
|
// See the XXX comment in `applyConfig()`
|
||||||
if (auto nixPathEnv = getEnv("NIX_PATH")) {
|
if (auto nixPathEnv = getEnv("NIX_PATH")) {
|
||||||
globalConfig.set("nix-path", concatStringsSep(" ", EvalSettings::parseNixPath(nixPathEnv.value())));
|
globalConfig.set("nix-path", concatStringsSep(" ", EvalSettings::parseNixPath(nixPathEnv.value())));
|
||||||
}
|
}
|
||||||
|
|
|
@ -352,6 +352,7 @@ EvalState::EvalState(
|
||||||
for (auto & i : settings.nixPath.get()) {
|
for (auto & i : settings.nixPath.get()) {
|
||||||
lookupPath.elements.emplace_back(LookupPath::Elem::parse(i));
|
lookupPath.elements.emplace_back(LookupPath::Elem::parse(i));
|
||||||
}
|
}
|
||||||
|
// TODO: only set if nothing else is
|
||||||
if (!settings.restrictEval) {
|
if (!settings.restrictEval) {
|
||||||
for (auto & i : EvalSettings::getDefaultNixPath()) {
|
for (auto & i : EvalSettings::getDefaultNixPath()) {
|
||||||
lookupPath.elements.emplace_back(LookupPath::Elem::parse(i));
|
lookupPath.elements.emplace_back(LookupPath::Elem::parse(i));
|
||||||
|
|
|
@ -42,6 +42,19 @@ done
|
||||||
# finding something that's not in any of the default paths fails
|
# finding something that's not in any of the default paths fails
|
||||||
( ! $(nix-instantiate --find-file test) )
|
( ! $(nix-instantiate --find-file test) )
|
||||||
|
|
||||||
|
# XXX: we can't manipulate $NIX_STATE_DIR contents on NixOS
|
||||||
|
# TODO: port to NixOS somehow; ideally we'd run the test suite in a non-NixOS VM
|
||||||
|
if [[ ! isTestOnNixOS ]]; then
|
||||||
|
mkdir -p $NIX_STATE_DIR/profiles/per-user/root/channels/nixpkgs
|
||||||
|
# check that the default values are set
|
||||||
|
[[ $(nix-instantiate --eval -E 'with builtins; length nixPath') = 2 ]]
|
||||||
|
# setting anything overrides the default paths
|
||||||
|
# this ensures we can force an empty search path
|
||||||
|
[[ $(NIX_PATH= nix-instantiate --eval -E 'with builtins; length nixPath') = 0 ]]
|
||||||
|
[[ $(nix-instantiate --nix-path "" --eval -E 'with builtins; length nixPath') = 0 ]]
|
||||||
|
[[ $(nix-instantiate -I "" --eval -E 'with builtins; length nixPath') = 1 ]]
|
||||||
|
fi
|
||||||
|
|
||||||
echo "nix-path = test=$TEST_ROOT/from-nix-path-file" >> "$test_nix_conf"
|
echo "nix-path = test=$TEST_ROOT/from-nix-path-file" >> "$test_nix_conf"
|
||||||
|
|
||||||
# Use nix.conf in absence of NIX_PATH
|
# Use nix.conf in absence of NIX_PATH
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue