Commit Graph

4744 Commits

Author SHA1 Message Date
Martin Weinelt
4bd0b9c7ab Reapply "Merge remote-tracking branch 'origin/master' into staging-next"
This reverts commit 106b1418bc.

Restores the commits lost during the revert of a merge on staging-next.
2025-08-23 16:06:41 +02:00
K900
e9a7500b70 Merge remote-tracking branch 'origin/master' into staging-next 2025-08-23 09:24:59 +03:00
Wolfgang Walther
aef40b0b5f lib/minfeatures: init from minver.nix (#433057) 2025-08-22 18:08:57 +00:00
nixpkgs-ci[bot]
a554ed914c Merge master into staging-next 2025-08-22 18:05:33 +00:00
Matt Sturgeon
5a07f707c5 lib.customisation.callPackageWith: fix line number interpolation
We need to use `toString` on `loc.line` because it is an int.
2025-08-22 18:48:43 +01:00
nixpkgs-ci[bot]
d263613f2e Merge master into staging-next 2025-08-22 12:06:42 +00:00
Wolfgang Walther
ab4281e967 lib/minfeatures: init from minver.nix
The concept of having a "minimum supported Nix version" doesn't work
anymore today, for the following reasons:
- With multiple forks / implementations of Nix available, their feature
sets and versions will differ. We'd need *multiple* minimum versions,
one for each implementation.
- Lix does not expose its real version. It only reports "2.18.3-lix",
even though its real version is in the 2.90+ range.
- A minimum version has the expectation that it could be *raised* in the
future. That's not possible with Lix, because Lix will always and
forever report the above version.
- A minimum version has the expectation that *all* versions bigger than
the minimum are supported. That was already quite a stretch when minver
was 2.3 and none of the Nix versions between 2.4 and 2.23 were packed
anymore. But it's impossible for us to test all these non-LTS versions
anyway: We don't have Nix 2.18, 2.19, 2.20, 2.21, 2.22, 2.23, 2.25, 2.26
and 2.27 available in Nixpkgs at the time of this writing.

With their policy around `builtins.nixVersion`, Lix forces our hand: We
need to replace minver.nix with a "feature detection" mechanism.

This PR introduces the first two features:
- The availability of `builtins.nixVersion`: If this is not available,
the version of Nix is so old, that we surely don't support it anymore.
- The value of `builtins.nixVersion` being greater or equal to 2.18.

Note, that this does **not** imply support for Nix 2.18. Instead,
explicitly supported versions of Lix and Nix are only these that we
actually test against.

If, eventually, we realize that the supported versions have advanced and
Nixpkgs has adopted a feature only available in newer versions, we will
have to add a feature check for this.

Put differently: The list of features in `minfeatures.nix` is not
expected to be complete. It's a list of known-to-be-bad conditions that
will cause problems when evaluating Nixpkgs. Their only purpose is to be
able to show a helpful error message. Some other versions might also not
be supported, but might fail with more subtle errors. That's just
reality and has always been the case previously as well.
2025-08-22 12:47:13 +02:00
Wolfgang Walther
be6f781b95 lib: cleanup after bump of minver (#433101) 2025-08-22 10:41:35 +00:00
Fabián Heredia Montiel
971840c5e0 Merge remote-tracking branch 'origin/master' into staging-next 2025-08-20 23:30:45 -06:00
quantenzitrone
dd9fa15dbf licenses.bsd3ClauseTso: rename and add spdxId
it got accepted and merged to spdx: https://github.com/spdx/license-list-XML/pull/2815
2025-08-21 05:24:42 +02:00
Johannes Kirschbauer
bb0bd3d413 lib/modules: add _internal to valueMeta of checkedAndMerged 2025-08-20 21:55:19 +02:00
Fabián Heredia Montiel
0e9af74ced Merge remote-tracking branch 'origin/master' into staging-next 2025-08-18 22:43:58 -06:00
Emily
6e959288bb lib.systems.examples: bump Android SDK and NDK
Per <https://github.com/android/ndk/wiki>, NDK 26 is EOL.
2025-08-18 16:52:14 +01:00
Johannes Kirschbauer
4f802d935c lib/modules: fix typo 2025-08-18 08:01:24 +02:00
nixpkgs-ci[bot]
6870d2a5fa Merge master into staging-next 2025-08-17 18:05:03 +00:00
Emily
922b6476c5 lib: deprecate fromHexString on dodgy inputs (#434218) 2025-08-17 17:17:43 +01:00
nixpkgs-ci[bot]
2bdc906674 Merge master into staging-next 2025-08-16 18:05:04 +00:00
Emily
3c7d67da23 lib: deprecate fromHexString on dodgy inputs
See <https://github.com/NixOS/nixpkgs/pull/433710>.
2025-08-16 13:36:05 +01:00
Emily
677ccc5446 lib: fix overflowing fromHexString tests and example (#433710) 2025-08-16 13:25:31 +01:00
Johannes Kirschbauer
1fed6029c2 lib/tests: introduce lib cross version checks
Needed to ensure backwards stability of types.merge.v2 added in #391544
2025-08-15 15:26:32 +02:00
Martin Weinelt
106b1418bc Revert "Merge remote-tracking branch 'origin/master' into staging-next"
This reverts commit 28cafe5795, reversing
changes made to 281c9189d4.

Broken merge due to mergiraf removing many newlines from
python-packages.nix.
2025-08-15 13:58:54 +02:00
Martin Weinelt
28cafe5795 Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/development/python-modules/dependency-groups/default.nix
	pkgs/development/python-modules/nox/default.nix
2025-08-15 12:42:37 +02:00
Johannes Kirschbauer
36bd116f11 lib: init lists.uniqueStrings (#355616) 2025-08-15 12:03:26 +02:00
Johannes Kirschbauer
78ac637056 lib: init lists.uniqueStrings 2025-08-15 11:45:50 +02:00
nixpkgs-ci[bot]
c0e9e1afcf Merge master into staging-next 2025-08-15 00:18:09 +00:00
Emily
47e013c679 lib/tests/test-with-nix: run misc.nix and fetchers.nix tests in the derivation (#433729) 2025-08-14 22:24:45 +01:00
Sergei Zimmerman
609c8799fa lib/tests/test-with-nix: run lib/tests/fetchers.nix in the derivation
This suffers from the same issue as misc.nix tests, because they
were evaluated by the host nix, not the one that is being tested.
2025-08-14 23:12:11 +03:00
Sergei Zimmerman
c2698371ef lib/tests/test-with-nix: remove broken import ./check-eval
This doesn't do the right thing here, because it evaluates
the test with nix that is evaluating the `nixpkgs-lib-tests-nix-${nix.version}`
derivation, not the Nix/Lix under test. This was just really busted for a long
time.
2025-08-14 23:12:09 +03:00
Emily
449ad44f16 lib: fix overflowing fromHexString tests and example
`fromHexString` is backed by `builtins.fromTOML`. Per [the TOML
v1.0.0 specification]:

> Arbitrary 64-bit signed integers (from −2^63 to 2^63−1) should be
> accepted and handled losslessly. If an integer cannot be represented
> losslessly, an error must be thrown.

[the TOML v1.0.0 specification]: <https://toml.io/en/v1.0.0#integer>

The saturating behaviour of the toml11 version currently used
by Nix is not lossless, and is therefore a violation of the TOML
specification. We should not be relying on it. This blocks the update
of toml11, as it became stricter about reporting this condition.

This, yes, is arguably an evaluation compatibility break. However,
integer overflow was recently explicitly defined as an error by
both Nix and Lix, as opposed to the C++ undefined behaviour it was
previously implemented as:

* <https://nix.dev/manual/nix/stable/release-notes/rl-2.25>
* <https://docs.lix.systems/manual/lix/stable/release-notes/rl-2.91.html#fixes>

This included changing `builtins.fromJSON` to explicitly
reject overflowing integer literals. I believe that the case for
`builtins.fromTOML` is comparable, and that we are effectively testing
undefined behaviour in TOML and the Nix language here, in the same way
that we would have been if we had tests relying on overflowing integer
arithmetic. I am not aware of any use of this behaviour outside of
these tests; the reverted toml11 bump in Nix did not break the 23.11
evaluation regression test, for example.

C++ undefined behaviour is not involved here, as toml11 used the C++
formatted input functions that are specified to saturate on invalid
values. But it’s still a violation of the TOML specification caused
by insufficient error checking in the old version of the library,
and inconsistent with the handling of overflowing literals in the
rest of Nix.

Let’s fix this so that Nix implementations can correctly flag up
this error and we can unblock the toml11 update.
2025-08-14 21:02:11 +01:00
Emily
6673e05ad0 lib: add fromHexString tests for distressing behaviour
This was cherry‐picked from
<https://github.com/NixOS/nixpkgs/pull/266705> and merged as part of
<https://github.com/NixOS/nixpkgs/pull/318712>, despite there being
a blocking review on the former pointing out these kinds of issues.

This documents some of the dodgy behaviour. It also can’t handle
negative literals. It might be worth considering deprecating and
dropping this, by inlining it into `lib.network.ipv6.fromString`,
its only in‐tree user.
2025-08-14 21:02:11 +01:00
Sergei Zimmerman
67ef2657ff lib/tests/test-with-nix: run misc.nix tests in the derivation
This would have allowed us to catch to fromTOML regression in
[1] without waiting for the dogfooding on master, since previously
these tests [2] were not run for the Nix/Lix under test - only the host
nix.

[1]: https://github.com/NixOS/nix/pull/13741
[2]: https://github.com/NixOS/nixpkgs/pull/433710
2025-08-14 19:22:35 +03:00
Sergei Zimmerman
76a7b54083 lib/tests/misc: don't hardcode store directory 2025-08-14 19:18:08 +03:00
Sergei Zimmerman
74799dd97c lib/tests/misc: don't import nixpkgs 2025-08-14 19:10:08 +03:00
K900
40539042b8 Merge remote-tracking branch 'origin/master' into staging-next 2025-08-13 21:30:19 +03:00
Johannes Kirschbauer
45ed757e10 types/addCheck: add tests for merge v1 and v2 2025-08-13 15:09:21 +02:00
Johannes Kirschbauer
cd2e5bd46c types/merge: move 'configuration' of submodules into nested attribute set 2025-08-13 15:09:21 +02:00
Johannes Kirschbauer
50bef19448 lib/modules: add nested 'headError.message'
This should make headError extensible other information needs to be passed
This seems to improve performance slightly
2025-08-13 15:09:20 +02:00
Johannes Kirschbauer
1765370051 lib/modules: test revert unentional regression in check 2025-08-13 15:09:20 +02:00
Johannes Kirschbauer
ebafc3eb74 lib/modules: optimize performance by inlining bindings 2025-08-13 15:09:20 +02:00
Johannes Kirschbauer
5d72133a22 lib/addCheck: add support for new merge 2025-08-13 15:09:20 +02:00
Johannes Kirschbauer
9f787b30e5 lib/modules: fix test by matching error message more generically 2025-08-13 15:09:20 +02:00
Johannes Kirschbauer
70ab11c2f2 lib/modules: add new merge.v2 for 'types.{either,coercedTo}' 2025-08-13 15:09:20 +02:00
Johannes Kirschbauer
648dbed1d6 lib/types: add 'checkDefsForError' utility for checking defs with a given check 2025-08-13 15:09:20 +02:00
Johannes Kirschbauer
8fa33000a3 lib.modules: add tests for option valueMeta 2025-08-13 15:09:20 +02:00
Robert Hensing
644527dd57 lib.modules: init types checkAndMerge to allow adding 'valueMeta' attributes
This allows individual types to add attributes that would be discarded during normal evaluation.
Some examples:

types.submodule performs a submodule evluation which yields an 'evalModules' result.
It returns '.config' but makes the original result accessible via 'valueMeta' allowing introspection of '.options' and all other kinds of module evaluation results

types.attrsOf returns an attribute set of the nestedType.
It makes each valueMeta available under the corresponding attribute name.
2025-08-13 15:09:20 +02:00
jefrwld
37c19df121 lib.attrsets: fix typo in attrVals documentation: 'attribitue' -> 'attribute' 2025-08-12 19:42:37 +02:00
K900
3f8d9e8f9c Merge remote-tracking branch 'origin/master' into staging-next 2025-08-12 17:09:22 +03:00
Wolfgang Walther
9b9bef020a lib.fileset: remove conditionals for Nix 2.4
minver is now at 2.18, which means that `fetchGit` support shallow
clones and submodules for sure.
2025-08-12 15:52:40 +02:00
Wolfgang Walther
dd435697b3 lib.customisation: remove unsafeGetAttrPos workaround
This could have been done a while ago, minver has been > 2.3.4 for quite
some time already.
2025-08-12 15:52:37 +02:00
Wolfgang Walther
fa0cba1c39 nix_2_3: drop
This has been marked insecure a while ago, as some CVEs have not been
backported. Even if *some* CVEs are fixed, we'd need **all** of them to
be, to get it back into the cache.

Not having it in the cache means, we can not test it in CI. This means
we can't make sure to actually support this version to evaluate Nixpkgs.
2025-08-12 11:28:40 +02:00