version.json: begin the 2.96 series

Change-Id: I21c37e20fc2e5786367aa9b6e5ebb7ba12eb8b6c
This commit is contained in:
Jade Lovelace
2026-03-13 22:59:53 +01:00
committed by eldritch horrors
parent c08f2336d0
commit 2cea406121
6 changed files with 81 additions and 46 deletions
@@ -0,0 +1,11 @@
---
synopsis: "Shadowing internal files through the Nix search path is now an error"
issues: [998]
cls: [4632, 5370]
category: "Breaking Changes"
credits: [thubrecht, jade, horrors]
---
As Lix uses the path `<nix/fetchurl.nix>` for bootstrapping purposes, the ability to shadow it by adding `nix=/some/path` (or `/other/path` that contains a `nix` directory) to the search path is not desirable.
Lix 2.95 deprecated this behavior with a warning, Lix 2.96 now turns it into a hard error if the `nix-path-shadow` deprecated feature isn't enabled. This deprecated feature is slated to be removed in Lix 2.98.
+30 -33
View File
@@ -297,30 +297,29 @@ EvalPaths::EvalPaths(
}
}
#if LIX_MAJOR >= 3 || (LIX_MAJOR == 2 && LIX_MINOR >= 96)
#if LIX_MAJOR >= 3 || (LIX_MAJOR == 2 && LIX_MINOR >= 98)
#warning \
"The feature nix-path-shadow was deprecated in 2.95 with a warning, which needs to be turned into an error in 2.96"
"The feature nix-path-shadow was deprecated in 2.95 with a warning, error in 2.96, and we should consider removing the bypass in 2.98"
#endif
if (!featureSettings.isEnabled(DeprecatedFeature::NixPathShadow)) {
for (auto & [prefix, path] : searchPath_.elements) {
// Match on the 'nix' prefix
if (prefix.s == "nix") {
logWarning(
{.msg = HintFmt(
"The prefix '%s' is reserved for internal use by Lix in the Nix search "
"path, its usage is deprecated and will be forbidden in the future.\n"
"Use %s to silence this warning.\n"
"This is due to adding '%s=%s' in the Nix search path, either through the "
"environment variable '%s' or by passing the flag %s to the nix "
"invocation.",
"nix",
"--extra-deprecated-features nix-path-shadow",
prefix.s,
path.s,
"NIX_PATH",
"-I"
)}
);
throw EvalError(HintFmt(
"The prefix '%s' is reserved for internal use by Lix in the Nix search "
"path, its usage is deprecated and will be forbidden in the future.\n"
"Use %s to silence this error.\n"
"This is due to adding '%s=%s' in the Nix search path, either through the "
"environment variable '%s' or by passing the flag %s to the nix "
"invocation.",
"nix",
"--extra-deprecated-features nix-path-shadow",
prefix.s,
path.s,
"NIX_PATH",
"-I"
));
} else
// Match prefixless paths that contain a `nix` directory
if (auto res =
@@ -333,21 +332,19 @@ EvalPaths::EvalPaths(
});
}))
{
logWarning(
{.msg = HintFmt(
"Shadowing '%s' by configuring the nix-path is deprecated and "
"will be forbidden in the future.\n"
"Use %s to silence this warning.\n"
"This is due to adding '%s' to the nix-path without a prefix, "
"either by passing the flag '-I %s' to the nix invocation or by "
"adding this path to the environment variable '%s'.",
"<nix/...>",
"--extra-deprecated-features nix-path-shadow",
path.s,
path.s,
"NIX_PATH"
)}
);
throw EvalError(HintFmt(
"Shadowing '%s' by configuring the nix-path is deprecated and "
"will be forbidden in the future.\n"
"Use %s to silence this error.\n"
"This is due to adding '%s' to the nix-path without a prefix, "
"either by passing the flag '-I %s' to the nix invocation or by "
"adding this path to the environment variable '%s'.",
"<nix/...>",
"--extra-deprecated-features nix-path-shadow",
path.s,
path.s,
"NIX_PATH"
));
}
}
}
@@ -1,3 +1,3 @@
warning: The prefix 'nix' is reserved for internal use by Lix in the Nix search path, its usage is deprecated and will be forbidden in the future.
Use --extra-deprecated-features nix-path-shadow to silence this warning.
This is due to adding 'nix=nix-shadow' in the Nix search path, either through the environment variable 'NIX_PATH' or by passing the flag -I to the nix invocation.
error: The prefix 'nix' is reserved for internal use by Lix in the Nix search path, its usage is deprecated and will be forbidden in the future.
Use --extra-deprecated-features nix-path-shadow to silence this error.
This is due to adding 'nix=nix-shadow' in the Nix search path, either through the environment variable 'NIX_PATH' or by passing the flag -I to the nix invocation.
@@ -1,3 +1,3 @@
warning: Shadowing '<nix/...>' by configuring the nix-path is deprecated and will be forbidden in the future.
Use --extra-deprecated-features nix-path-shadow to silence this warning.
This is due to adding 'nix-shadow' to the nix-path without a prefix, either by passing the flag '-I nix-shadow' to the nix invocation or by adding this path to the environment variable 'NIX_PATH'.
error: Shadowing '<nix/...>' by configuring the nix-path is deprecated and will be forbidden in the future.
Use --extra-deprecated-features nix-path-shadow to silence this error.
This is due to adding 'nix-shadow' to the nix-path without a prefix, either by passing the flag '-I nix-shadow' to the nix invocation or by adding this path to the environment variable 'NIX_PATH'.
@@ -1,7 +1,7 @@
from collections.abc import Callable
from pathlib import Path
from lang.test_lang import test_eval_okay as nix_eval
from lang.test_lang import test_eval_fail as nix_eval_fail, test_eval_okay as nix_eval_okay
from testlib.fixtures.file_helper import AssetSymlink, CopyFile, CopyTree, with_files
from testlib.fixtures.nix import Nix
from testlib.fixtures.snapshot import Snapshot
@@ -21,7 +21,7 @@ from testlib.fixtures.snapshot import Snapshot
)
def test_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
nix.env.set_env("NIX_PATH", "dir3:dir4")
nix_eval(
nix_eval_okay(
files,
nix,
[
@@ -43,12 +43,26 @@ def test_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot])
"nix-shadow": CopyTree("nix-shadow"),
"in.nix": CopyFile("in-fetchurl.nix"),
"out.exp": AssetSymlink("eval-okay-prefixed.out.exp"),
}
)
def test_prefixed_search_path_deprecated(
files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]
):
nix.env.set_env("NIX_PATH", "nix=nix-shadow")
nix.settings.add_dp_feature("nix-path-shadow")
nix_eval_okay(files, nix, [], snapshot)
@with_files(
{
"nix-shadow": CopyTree("nix-shadow"),
"in.nix": CopyFile("in-fetchurl.nix"),
"err.exp": AssetSymlink("eval-okay-prefixed.err.exp"),
}
)
def test_prefixed_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
nix.env.set_env("NIX_PATH", "nix=nix-shadow")
nix_eval(files, nix, [], snapshot)
nix_eval_fail(files, nix, [], snapshot)
@with_files(
@@ -56,11 +70,24 @@ def test_prefixed_search_path(files: Path, nix: Nix, snapshot: Callable[[str], S
"nix-shadow": CopyTree("nix-shadow"),
"in.nix": CopyFile("in-fetchurl.nix"),
"out.exp": AssetSymlink("eval-okay-prefixless.out.exp"),
}
)
def test_prefixless_search_path_deprecated(
files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]
):
nix.settings.add_dp_feature("nix-path-shadow")
nix_eval_okay(files, nix, ["-I", "nix-shadow"], snapshot)
@with_files(
{
"nix-shadow": CopyTree("nix-shadow"),
"in.nix": CopyFile("in-fetchurl.nix"),
"err.exp": AssetSymlink("eval-okay-prefixless.err.exp"),
}
)
def test_prefixless_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
nix_eval(files, nix, ["-I", "nix-shadow"], snapshot)
nix_eval_fail(files, nix, ["-I", "nix-shadow"], snapshot)
@with_files(
@@ -71,4 +98,4 @@ def test_prefixless_search_path(files: Path, nix: Nix, snapshot: Callable[[str],
}
)
def test_empty_search_path(files: Path, nix: Nix, snapshot: Callable[[str], Snapshot]):
nix_eval(files, nix, [], snapshot)
nix_eval_okay(files, nix, [], snapshot)
+2 -2
View File
@@ -1,5 +1,5 @@
{
"version": "2.95.0",
"version": "2.96.0-dev",
"official_release": false,
"release_name": "Kakigōri"
"release_name": "TBD"
}