diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index a27c53043c74e37e7d8b586d5049d0db2b31b9c9..a19269b33cc55ac68ccdedc121e1c30272825254 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -388,7 +388,7 @@ expr_simple string path($1 + 1, strlen($1) - 2); $$ = new ExprApp(CUR_POS, new ExprApp(new ExprVar(data->symbols.create("__findFile")), - new ExprVar(data->symbols.create("nixPath"))), + new ExprVar(data->symbols.create("__nixPath"))), new ExprString(data->symbols.create(path))); } | URI { $$ = new ExprString(data->symbols.create($1)); } diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 543266b22aa1b85d5ab3d32835f7464981689830..4436b636ba4ffd039ef41b5c9e4f82be998bc33e 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -710,7 +710,7 @@ static void prim_readFile(EvalState & state, const Pos & pos, Value * * args, Va /* Find a file in the Nix search path. Used to implement <x> paths, - which are desugared to ‘findFile nixPath "x"’. */ + which are desugared to ‘findFile __nixPath "x"’. */ static void prim_findFile(EvalState & state, const Pos & pos, Value * * args, Value & v) { state.forceList(*args[0], pos); @@ -1472,7 +1472,7 @@ void EvalState::createBaseEnv() mkString(*allocAttr(*v2, symbols.create("prefix")), i.first); v2->attrs->sort(); } - addConstant("nixPath", v); + addConstant("__nixPath", v); /* Now that we've added all primops, sort the `builtins' set, because attribute lookups expect it to be sorted. */ diff --git a/tests/lang/eval-okay-search-path.nix b/tests/lang/eval-okay-search-path.nix index f48bf3fad2184f5e8737becefbc6b691097d3d6c..cca41f821f839f87ca914e900c2f3289542a4286 100644 --- a/tests/lang/eval-okay-search-path.nix +++ b/tests/lang/eval-okay-search-path.nix @@ -3,9 +3,9 @@ with builtins; assert pathExists <nix/buildenv.nix>; -assert length nixPath == 6; -assert length (filter (x: x.prefix == "nix") nixPath) == 1; -assert length (filter (x: baseNameOf x.path == "dir4") nixPath) == 1; +assert length __nixPath == 6; +assert length (filter (x: x.prefix == "nix") __nixPath) == 1; +assert length (filter (x: baseNameOf x.path == "dir4") __nixPath) == 1; import <a.nix> + import <b.nix> + import <c.nix> + import <dir5/c.nix> - + (let nixPath = [ { path = ./dir2; } { path = ./dir1; } ]; in import <a.nix>) + + (let __nixPath = [ { path = ./dir2; } { path = ./dir1; } ]; in import <a.nix>)