Commit Graph

4785 Commits

Author SHA1 Message Date
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
Wolfgang Walther
cc3d2295b6 nixVersions.minimum: drop
The concept of this alias becomes questionable once we move past 2.18,
where Lix was forked. We should probably move to a feature-detection
based approach for lib/minver.nix eventually, too.
2025-08-12 11:28:38 +02:00
Martin Weinelt
98214d19e0 Merge remote-tracking branch 'origin/master' into staging-next
Conflicts:
	pkgs/development/python-modules/django-stubs-ext/default.nix
	pkgs/development/python-modules/django-stubs/default.nix
	pkgs/development/python-modules/python-roborock/default.nix
2025-08-10 14:46:08 +02:00
Robert Hensing
f5d1677b8e lib.attrsets.filterAttrs: Add tips / guidance (#428330) 2025-08-10 13:25:49 +02:00
nixpkgs-ci[bot]
6fa945bccb Merge staging-next into staging 2025-08-07 12:08:02 +00:00
Shahar "Dawn" Or
5186921ded lib.evalModules: add graph attribute
Co-authored-by: Ali Jamadi <jamadi1377@gmail.com>
2025-08-07 11:38:16 +07:00
Ali Jamadi
2c1ec14d12 lib/modules: extract isDisabled from filterModules
Co-authored-by: Shahar "Dawn" Or <mightyiampresence@gmail.com>
2025-08-07 11:27:10 +07:00
K900
58bee57776 Merge remote-tracking branch 'origin/staging-next' into staging 2025-08-04 15:20:57 +03:00
Robert Hensing
d7d16d6bf0 lib.modules: Add hint when using config in imports (#430204) 2025-08-04 10:11:49 +02:00
Robert Hensing
5620fc678e lib.modules: Improve infinite recursion hint
hsjobeki: Using config in imports is possible in general. But its not possible to do conditional imports where the condition depends on config. Thats two different statements.

Co-authored-by: Johannes Kirschbauer <hsjobeki+github@gmail.com>
2025-08-04 10:05:26 +02:00