forked from lix-project/lix
Merge "builtins.nixVersion: return fixed fake version" into main
This commit is contained in:
commit
706cee5c49
|
@ -4299,25 +4299,16 @@ void EvalState::createBaseEnv()
|
||||||
.impureOnly = true,
|
.impureOnly = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
v.mkString(nixVersion);
|
v.mkString("2.18.3-lix");
|
||||||
addConstant("__nixVersion", v, {
|
addConstant("__nixVersion", v, {
|
||||||
.type = nString,
|
.type = nString,
|
||||||
.doc = R"(
|
.doc = R"(
|
||||||
The version of Nix.
|
Legacy version of Nix. Always returns "2.18.3-lix" on Lix.
|
||||||
|
|
||||||
For example, where the command line returns the current Nix version,
|
To determine if features exist, Nix scripts should instead use direct
|
||||||
|
means of feature detection, such as checking for existence of
|
||||||
```shell-session
|
builtins they want to use. Doing so allows for much better compatibility
|
||||||
$ nix --version
|
across implementations.
|
||||||
nix (Nix) 2.16.0
|
|
||||||
```
|
|
||||||
|
|
||||||
the Nix language evaluator returns the same value:
|
|
||||||
|
|
||||||
```nix-repl
|
|
||||||
nix-repl> builtins.nixVersion
|
|
||||||
"2.16.0"
|
|
||||||
```
|
|
||||||
)",
|
)",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -611,7 +611,7 @@ namespace nix {
|
||||||
|
|
||||||
TEST_F(PrimOpTest, nixVersion) {
|
TEST_F(PrimOpTest, nixVersion) {
|
||||||
auto v = eval("builtins.nixVersion");
|
auto v = eval("builtins.nixVersion");
|
||||||
ASSERT_THAT(v, IsStringEq(nixVersion));
|
ASSERT_THAT(v, IsStringEq("2.18.3-lix"));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(PrimOpTest, currentSystem) {
|
TEST_F(PrimOpTest, currentSystem) {
|
||||||
|
|
Loading…
Reference in a new issue