Commit graph

4742 commits

Author SHA1 Message Date
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
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
nixpkgs-ci[bot] 590adebb71
Merge staging-next into staging 2025-08-02 12:07:14 +00:00
Robert Hensing c34e08489e lib.modules: Adjust error message
- Lower case error trace for consistency
- Be more explicit about the condition under which the hint applies,
  and the resolution.
2025-08-02 11:17:26 +02:00
Robert Hensing 3d15b12d8f lib.modules: Make _module.args evaluation explicit in trace 2025-08-02 11:17:26 +02:00
Robert Hensing 9dad048f21 lib.modules: Generalize the import hint to _module.args 2025-08-02 10:51:09 +02:00
Robert Hensing e28f3f0cd0 lib.modules: Test infinite recursion hint
We don't want it to occur in the trace of any unrelated errors.
2025-08-02 10:40:00 +02:00
49016 7a787e122b lib.modules: Add hint when using config in imports 2025-08-01 22:09:02 +02:00
Leona Maroni c62f186127
lib/trivial: update oldestSupportedRelease to 2505
24.11 is deprecated now
2025-08-01 16:05:51 +02:00
nixpkgs-ci[bot] c0dd2454fa
Merge staging-next into staging 2025-08-01 00:21:45 +00:00
Ross Smyth 4af7c6bdee lib.systems: Add examples & helpers for MSVC 2025-07-31 11:41:15 -04:00
Zitrone 3c1d6186b0 libx11: refactor, move to pkgs/by-name and rename from xorg.libX11
refactorial changes:
- move `CPP` into `env`
- remove `sed 's,^as_dummy.*,as_dummy="\$PATH",' -i configure` because
  it didn't change anything other than the store paths in the resulting
  derivation (using `diff --recursive` (and `xxd` to diff binary files
  that changed))
- remove `xorg.buildPackages.libc.static` from `depsBuildBuild` since
  `xorg.buildPackages` doesn't exist (thus
  `xorg.buildPackages.libc.static or null` evaluating to `null`).
  Fixing that to `libc.static` (and moving it to `nativeBuildInputs`
  (where non-compiler deps belong)) actually broke the static build in
  a weird way i don't understand.
2025-07-31 10:33:30 +02:00
Robert Hensing b3255718ac lib, mkDerivation: Document overriding functions
These doc comments are mainly for consumption in the repl.
2025-07-27 21:44:18 +02:00
Robert Hensing 77c2981a7d lib.attrsets.filterAttrs: Add tips to doc 2025-07-27 15:39:35 +02:00
Wolfgang Walther 90604d95bc
Merge branch 'staging-next' into staging 2025-07-24 14:33:09 +02:00
Wolfgang Walther 5a0711127c
treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Philip Taron 77dca5875a
treewide: populate arch and platform for more node packages (#422938) 2025-07-15 09:18:57 -07:00
Rebecca Turner 4a81a5e556
lib.packagesFromDirectoryRecursive: Allow non-"path" directory
As initially designed, `lib.packagesFromDirectoryRecursive` allowed
passing a string for the `directory` argument. This is necessary for
several reasons:

- `outPath` on derivations and Flake inputs is not a path.
- Derivations can be coerced to their `outPath` in string interpolation,
  but that produces strings, not paths.
- `builtins.path`, bizarrely, returns a string instead of a path (not
  that the documentation makes this clear).

If a path is used instead of a string here, then Nix will dutifully copy
the entire directory into a new path in the Nix store (ignored as
WONTFIX by Eelco in https://github.com/NixOS/nix/issues/9428). For
industrial use cases, this can result in an extra 10-15 seconds on every
single eval just to copy files from one spot in the Nix store to another
spot in the Nix store.

In #361424, this was changed so that `directory` must be a path,
breaking these use-cases.

I'm not really sure what happened here -- #361424 has very little
justification for why it exists, only a reference to a previous version
of the PR (#359941), which itself had very little justification given.
The description on #359941 explained that it would "Shrink the
function's code by ~2/3rd 🎉", but 60% of the reduction in size was just
deleting comments (!) and bindings like `directoryEntryIsPackage` that
helped clarify the intent of the implementation. As a result, the new
implementation is (to my eyes) more challenging to read and understand.
I think the whole thing was in service of #392800, which adds a
`newScope` argument in order "to create nested scopes for each
(sub)directory (not just the top-level one) when `newScope` is given."

Nobody noticed this regression until after the commit was merged. After
@phanirithvij pointed out the regression, @nbraud said they would
"shortly prepare a PR to fix this" [1] but did not. Later, they would
explain that they were "quite ill the last month(s)" [2], which explains
why this got forgotten about. @nbraud also requested a review from
@Gabriella439 [3], as she had reviewed the original PR adding
`lib.packagesFromDirectoryRecursive`, but not from me, the original
author of that PR. @Gabriella439 did not review the "refactor" PR, and
no attempt to contact her or myself was made after that initial request.
This behavior is admittedly rather subtle, so I'm not sure either
Gabriella or myself would have noticed the change (especially since the
relevant PR restructures the entire implementation).

While I find this a bit frustrating, I should have added a test for this
use-case in my original PR; if there was a test that relied on passing
paths in as a string, perhaps the authors modifying this code would have
noticed that the implementation was not an accident.

[1]: https://github.com/NixOS/nixpkgs/pull/361424#discussion_r1912407693
[2]: https://github.com/NixOS/nixpkgs/pull/359984#issuecomment-2775768808
[3]: https://github.com/NixOS/nixpkgs/pull/361424#issuecomment-2521308983
2025-07-10 16:13:38 -07:00
Sandro e2be354fc2
lib/sources: add jj to clean source (#423613) 2025-07-09 14:52:35 +02:00
Will Fancher ff4b407e3c lib/sources: add jj to clean source 2025-07-08 17:05:05 -04:00
Colin b3daf8c3a5 nodejs: split destCPU into stdenv.$platform.node
this architecture mapping is used broadly in the node ecosystem.
an assortment of tools and hooks, like buildNpmPackage or
pnpm.configHook, will benefit from reusing these values. placing them in
stdenv makes sense because (1) several of these tools don't currently
depend on nodejs, and may even be available where nodejs is not and (2)
`stdenv.{build,host,target}Platform` seems to be less error-prone than
`pkgs*.nodejs.{os,arch}` -- especially for setup hooks where the offsets
are shifted.
2025-07-07 03:07:58 +00:00
OPNA2608 8c6307d19b lib.systems.examples: Add rust.rustcTarget for ppc64-elfv1 2025-07-05 22:16:59 +02:00
Johannes Kirschbauer d3cd84d2b2
doc: fix example consistency on mapAttrsRecursiveCond (#418991) 2025-07-04 21:54:15 +02:00
Johannes Kirschbauer 86603255c3
lib.filesystem.resolveDefaultNix: init (#418824) 2025-07-03 12:54:47 +02:00
Philip Taron 169776212b
fetchedMavenDeps: support proxy and custom cacerts (#420608) 2025-06-30 17:26:00 -07:00
Alyssa Ross a61841a597 nixVersions.nix_2_3: add knownVulnerabilities 2025-06-30 10:26:29 +02:00
Wolfgang Walther b4532efe93
**/README.md: one sentence per line
As documented in doc/README.md.
2025-06-29 21:14:32 +02:00
Florian Klink f8b6b6f512 lib/fetchers: remove unused imports 2025-06-27 21:27:44 +03:00
OPNA2608 3a51005a85 lib.systems.inspect.patterns: init isAbiElfv1 2025-06-26 09:28:04 +02:00
sodiboo b3c9916455 lib.types.attrTag: expose suboptions at correct level 2025-06-22 21:23:18 +02:00
Léana 江 a2f1023f57
doc: fix example consistency on mapAttrsRecursiveCond
The example should take a two argument function `f`.
2025-06-22 15:26:07 +02:00
Robert Hensing 66016feb83 lib.callPackageWith: Use resolveDefaultNix
Tested with:
1. Replace the callPackageWith call by `null`, to simulate an ancient Nix
2. Run the following commands in a terminal in nixpkgs:

    $ mkdir test/

    $ echo '{ asdfasdfasdf }: null' >test/default.nix

    $ nix repl -f .

    nix-repl> callPackage ./test { }
    error:
          … while calling the 'abort' builtin
            at /home/user/src/nixpkgs/lib/customisation.nix:312:7:
              311|     else
              312|       abort "lib.customisation.callPackageWith: ${error}";
                |       ^
              313|

          error: evaluation aborted with the following error message: 'lib.customisation.callPackageWith: Function called without required argument "asdfasdfasdf" at /home/user/src/nixpkgs/test/default.nix'
2025-06-21 21:43:37 +02:00
Robert Hensing ecc039f327 lib.filesystem.resolveDefaultNix: init 2025-06-21 21:43:37 +02:00
OPNA2608 f5d07900bf lib.systems.examples: Split glibc powerpc64 back into 2 ABI options
ELFv1 is the historically better supported one on glibc, ELFv2 seems to have some issues with our toolchain.

Restore the option to pick the ABI with pkgsCross.
2025-06-21 11:01:02 +02:00
Johannes Kirschbauer 1849ee507e
modules: Add _prefix module argument, improve error, add docs (#398839) 2025-06-19 16:09:07 +02:00
Johannes Kirschbauer 982c74a71e
lib.derivations: avoid common double-warn with warnOnInstantiate (#414606) 2025-06-19 15:54:57 +02:00
Martin Weinelt 8cfa86cf70
Merge remote-tracking branch 'origin/master' into staging-next 2025-06-11 05:13:32 +02:00
Jade Lovelace 332bc64369 ci/eval: accept nix directly
Previously we were taking nixVersions and this made external use from
the Lix repo's CI annoying.

We should probably also test other nix versions than stable (i.e. also
latest and Lix), but this involves writing GitHub Actions about it and
maybe not running it on every single PR. Future work.
2025-06-10 16:04:38 -07:00
lassulus 78f051e8af
lib, treewide: introduce repoRevToName and use it to cleanup most fetch* functions (#316668) 2025-06-10 22:49:23 +02:00
nixpkgs-ci[bot] 058022493d
Merge master into staging-next 2025-06-10 06:06:12 +00:00
Florent Charpentier b6bb27bc38 lib.mkEnableOption: fix syntax error in example comment 2025-06-10 00:11:31 +02:00
Peder Bergebakken Sundt 19086768fe lib.derivations: avoid common double-warn with warnOnInstantiate
Before:

    $ nix-build . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    /nix/store/8g0lfv82s0sprmqgfj146ggkb7bn3rm6-adaptivecpp-25.02.0

    $ nix-instantiate . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    warning: you did not specify '--add-root'; the result might be removed by the garbage collector
    /nix/store/b8q5xp94s4n7zfn7as5a9xjvylh6y3pi-adaptivecpp-25.02.0.drv

After:

    $ nix-build . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    /nix/store/8g0lfv82s0sprmqgfj146ggkb7bn3rm6-adaptivecpp-25.02.0

    $ nix-instantiate . -A opensycl
    trace: evaluation warning: 'opensycl' has been renamed to 'adaptivecpp'
    warning: you did not specify '--add-root'; the result might be removed by the garbage collector
    /nix/store/b8q5xp94s4n7zfn7as5a9xjvylh6y3pi-adaptivecpp-25.02.0.drv
2025-06-07 00:53:56 +02:00
Zitrone 2298cf9994 xorgproto: refactor and move to pkgs/by-name from xorg namespace 2025-06-06 21:56:40 +02:00
nixpkgs-ci[bot] f5096bbfa6
Merge master into staging-next 2025-06-02 18:05:37 +00:00
Pol Dellaiera 6d9d3014ba
treewide: fix typos in comments (#413240) 2025-06-02 18:43:07 +02:00
Johannes Kirschbauer f54b76bc01
lib/types: add doc warning to addCheck (#412364) 2025-06-02 18:39:27 +02:00
Peder Bergebakken Sundt c77ac9dfc3 treewide: fix typos 2025-06-02 16:07:07 +02:00
nixpkgs-ci[bot] bb90e78db3
Merge master into staging-next 2025-06-02 12:06:59 +00:00
Wolfgang Walther a7f4e0f9ae
lib/tests: avoid full rebuild when only maintainers change
The vast majority of CI jobs to build the lib tests are caused by
changes in the maintainer list. In this case, we currently run the full
test-suite which takes 3-4 minutes. By moving the maintainers and teams
tests out of the test-with-nix file, we save almost all of that.
Building only those two tests on a change is almost instant. This only
works, because we previously enabled cachix for the workflow.

Note, that these tests are not actually run with both nix versions, even
though they were listed in the "test with specific nix version" file.
That's because we only differ in the nix version run *inside* the
sandbox, but not doing the outer build.

Since this file seems to be re-used by NixOS/nix' CI, this is
technically a small loss in coverage for that repo, but nixpkgs CI
considerations outweigh that. But because of this, I left the other
non-nix-version-specific tests in that file.
2025-06-02 09:12:19 +02:00
Jan Malakhovski 7c8a4efb68 lib, treewide: introduce repoRevToName, use it in most fetch* functions
This patch adds `lib.repoRevToName` function that generalizes away most of the
code used for derivation name generation by `fetch*` functions (`fetchzip`,
`fetchFromGitHub`, etc, except those which are delayed until latter commits
for mass-rebuild reasons).

It's first argument controls how the resulting name will look (see below).

Since `lib` has no equivalent of Nixpkgs' `config`, this patch adds
`config.fetchedSourceNameDefault` option to Nixpkgs and then re-exposes
`lib.repoRevToName config.fetchedSourceNameDefault` expression as
`pkgs.repoRevToNameMaybe` which is then used in `fetch*` derivations.

The result is that different values of `config.fetchedSourceNameDefault` now
control how the `src` derivations produced by `fetch*` functions are to be
named, e.g.:

- `fetchedSourceNameDefault = "source"` (the default):

  ```
  $ nix-instantiate -A fuse.src
  /nix/store/<hash>-source.drv
  ```

- `fetchedSourceNameDefault = "versioned"`:

  ```
  $ nix-instantiate -A fuse.src
  /nix/store/<hash>-libfuse-2.9.9-source.drv
  ```

- `fetchedSourceNameDefault = "full"`:

  ```
  $ nix-instantiate -A fuse.src
  /nix/store/<hash>-libfuse-2.9.9-github-source.drv
  ```

See the documentation of `config.fetchedSourceNameDefault` for more info.
2025-05-31 10:01:21 +00:00
nixpkgs-ci[bot] 3025596725
Merge master into staging-next 2025-05-31 00:16:33 +00:00
Johannes Kirschbauer 7063762d13
lib/types: add doc warning to addCheck 2025-05-30 16:25:44 +02:00
Alyssa Ross f4c841ae5e
lib.systems: don't throw if go unsupported
Better to have a value that can actually be checked for, rather than
throwing, so optional Go support can be disabled when unsupported.
2025-05-30 14:57:33 +02:00
nixpkgs-ci[bot] aabaf9f281
Merge staging-next into staging 2025-05-29 18:06:18 +00:00
jopejoe1 0b29af4760
xkeyboard-config, xtrans, xorg-{cf-files,docs,sgml-doctools}: refactor and move to pkgs/by-name from xorg namespace (#398391) 2025-05-28 20:58:05 +02:00
Gutyina Gergő b3b0fd266b
lib: prefer replaceString over replaceStrings 2025-05-28 00:20:57 +02:00
Gutyina Gergő b5720e2b3f
lib/strings: init replaceString 2025-05-28 00:20:56 +02:00
Philip Taron 9b3545da9e
lib.systems.loongarch64-multiplatform: init (#402689) 2025-05-27 08:48:18 -07:00
Wolfgang Walther 94817274d2
lib.fileset.difference: fix type docs 2025-05-26 22:05:23 +02:00
Weijia Wang 9988795010 lib.systems.loongarch64-multiplatform: init 2025-05-25 14:43:14 +02:00
Zitrone 7e7e5721a6
xorg-docs: refactor, move to pkgs/by-name and rename from xorg.xorgdocs 2025-05-25 05:41:43 +02:00
Emily 98dbc7cc58 Revert "lib.meta.availableOn: Return false if pkg parameter is null"
I believe this change is wrong both theoretically and practically.

Theoretically, `null` is available on every platform, because
`buildInputs = [ null ];` always succeeds and never throws a platform
availability error. `null` should be handled consistently with packages
that have no explicit list of supported platforms, as it of course
has no such list itself.

Practically, we use `null` to represent libraries that are always
present on a platform and do not require a library (for instance,
because they are part of `libc` or the macOS SDK). This has been
used for a long time by `libintl` (on all non‐glibc platforms),
and is also now used by `libGL` and friends on Darwin. This change
broke the check SDL3 does for OpenGL availability on Darwin, causing
<https://github.com/NixOS/nixpkgs/issues/407056>, which had to be
worked around by <https://github.com/NixOS/nixpkgs/pull/409525>.

Both `libintl` and `libGL` should count as available on platforms
where their functionality is part of the standard build environment,
and a package that is completely unavailable and whose functionality
cannot be expected should not use `null`, as it should result in
errors if used in a dependency list on an unsupported platform.

I accept that overriding with `null` is often a useful way to disable
dependencies that don’t have explicit feature flags, but I do not
think that making it work better with feature flags conditioned on
availability is worth the inconsistency and problems caused by this
change. Packages can instead expose the relevant feature flags as
arguments that default to the `lib.meta.availableOn` check or, if they
want to keep an “override the dependency to `null`” interface,
insert an explicit `pkg != null && …` check.

Additionally, the pull request was merged over a week after all
breaking changes were restricted for the 25.05 release. I believe that
the potential problems of dealing with the effects of this change for
an entire release cycle – the first release cycle where `libGL` is
`null` on Darwin, a change I made before the deadline and before this
change to `lib.meta.availableOn` – offset the risks of backporting
this revert at such a late stage.

It will cause overrides to backwards‐incompatibly revert to the
behaviour they had before the change, but since such overrides were
not possible until a few weeks ago, I hope that is an acceptable risk
compared to the potential issues leaving this in the release can
cause, given that it was merged after the deadline and has already
broken an existing construction in Nixpkgs.

This reverts commit 9338d924db.
2025-05-23 15:09:41 +01:00
Aleksana 48b56e8fb5
lib.systems: raise minimum loongarch64 feature support (#403201) 2025-05-23 10:00:37 +08:00
Aleksana b2fc900a32
lib.systems.elaborate.canExecute: handle different gcc.arch (#403549) 2025-05-23 09:59:10 +08:00
aleksana 54e53047bf lib.systems.examples: separate loongarch64 for desktop and embedded variants 2025-05-22 19:59:54 +08:00
aleksana b6b5125d03 lib.systems.architectures: add loongarch64 2025-05-22 19:00:07 +08:00
aleksana 1802f697e4 lib.systems.elaborate.canExecute: handle different gcc.arch 2025-05-22 18:57:28 +08:00
aleksana 330fdc9943 lib.systems.architectures: add hasInferior and canExecute function 2025-05-22 18:57:28 +08:00
Simon Hollingshead 6b6e23bfda
treewide: maintainers-list.nix -> maintainer-list.nix (#409585) 2025-05-22 15:42:16 +05:30
Johannes Kirschbauer b7d438b87c
lib.strings: init toCamelCase (#402372) 2025-05-18 22:18:39 +02:00
Sigmanificient 6b782a9ebe lib/.version: Fix version file formatting 2025-05-16 19:53:23 +02:00
Leona Maroni e56e0beed4
25.11 is Xantusia 2025-05-16 19:21:55 +02:00
Arian van Putten 871526be1f
nixos/image/repart: Use own assertions / warnings. (#406940) 2025-05-15 19:14:53 +02:00
Aleksana 40a774220d
ipxe: correct licensing information (#390934) 2025-05-15 21:42:59 +08:00
Alyssa Ross 7eb2580981 lib.systems.examples.riscv64-musl: init 2025-05-15 14:44:58 +02:00
Morgan Jones 865c1cb0e9
lib/systems: remove android cruft (#406682) 2025-05-14 17:46:48 -07:00
Will Fancher 4b0d1225f5 lib/asserts: Factor out NixOS's toplevel assertion / warning logic. 2025-05-14 01:21:10 -04:00
Fernando Rodrigues 8d21ee745e
licenses: add gpl2UBDLPlus
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2025-05-13 16:49:21 +00:00
Morgan Jones 9d3c069cbd
lib/systems: remove android cruft
These used legacy names for Android SDK and NDK versions, so now we can
do away with them.
2025-05-12 23:43:16 -07:00
Jeremy Fleischman 63c815dd79
docs: fix typo: readDir -> dirOf
The example code here uses `dirOf`, not `readDir`. I assume this was
just a silly typo.
2025-05-12 00:36:30 -07:00
Heitor Augusto 24e8a790b7
lib.strings: init toCamelCase 2025-05-11 20:24:56 -03:00
Matt Sturgeon 1fb1446380
lib.modules.importApply: Fix doc typo; _keykey
The `importApply` docs reference using the `_key` attr along with
`importApply` or `_file`, however the actual attr name used by the
module system is `key`.
2025-05-08 17:48:50 +01:00
Johannes Kirschbauer 5ee93d2532
lib: refactor lib.attrsets.{mapAttrs', mapAttrsToList} and mapAttrs'' in the strongswan-swanctl module (#403581) 2025-05-08 09:42:40 +02:00
ccicnce113424 4551258940 lib: refactor lib.attrsets.{mapAttrs', mapAttrsToList} and mapAttrs'' in the strongswan-swanctl module
The new implementation of `mapAttrsToList` is simpler than the previous one, avoiding an extra string conversion. Benchmarking shows a slight performance improvement. See the discussion here: https://discourse.nixos.org/t/another-implementation-of-mapattrstolist

Additionally, I searched nixpkgs for expressions equivalent to the old `mapAttrsToList` and replaced them with direct calls to the new implementation.
2025-05-08 13:58:54 +08:00
Wolfgang Walther c8d2eca963
.editorconfig: move subfolder config into separate .editorconfig files
This avoids paths in the top-level file getting out-of-sync, because the
.editorconfig files would be moved together with the files they target.
2025-05-07 20:01:35 +02:00
Vladimír Čunát 7aeb16e7ff
Merge master into staging-next 2025-05-04 08:07:53 +02:00
Jörg Thalheim 211568d4fd
lib.systems: add golang platform dialect (#403030) 2025-05-04 06:04:53 +02:00
nixpkgs-ci[bot] 7be7cc17c3
Merge master into staging-next 2025-05-02 18:05:12 +00:00
adisbladis 9338d924db lib.meta.availableOn: Return false if pkg parameter is null
To fix overriding packages that checks for platform compatibility, like pipewire.

`pipewire` contains the following logic to enable support for ldac depending on library platform compatibility:
```nix
ldacbtSupport = lib.meta.availableOn stdenv.hostPlatform ldacbt
```

Which is used later in the expression to create a Meson flag:
```nix
(lib.mesonEnable "bluez5-codec-ldac" (bluezSupport && ldacbtSupport))
```

This means that attempting to build `pipewire` without `ldacbt` like:
```nix
pipewire.override {
  ldacbt = null;
}
```
will fail because the the Meson flag indicates the feature should be enabled, but the library is passed to `buildInputs` as `null`.
2025-05-02 19:01:17 +02:00
aleksana e1828f9668 lib.systems: add golang platform dialect 2025-04-30 22:05:32 +08:00
K900 19e54b8a69 Merge remote-tracking branch 'origin/master' into staging-next 2025-04-30 07:14:48 +03:00
aleksana 06bb544356 lib.systems.inspect.patterns.isEfi: add loongarch 2025-04-29 22:50:31 +08:00
nixpkgs-ci[bot] c376a565f9
Merge staging-next into staging 2025-04-24 18:04:57 +00:00
jopejoe1 13c1207a12
font-{alias,util}, gccmakedep, libp{ciacces,threadstub}s: refactor and migrate to pkgs/by-name from xorg namespace (#369520) 2025-04-24 19:11:58 +02:00
zowoq 0931f4e861 Revert "pkgs/top-level/stage.nix: add pkgsLLVMLibc"
This reverts commit 41b14024d2.
2025-04-24 14:04:25 +10:00
Johannes Kirschbauer be393db73e
lib.takeEnd: init (#398222) 2025-04-23 14:20:47 +02:00
Johannes Kirschbauer bda0c8532b
lib.getAttrFromPath: fix docs (#400948) 2025-04-23 14:09:23 +02:00
Pol Dellaiera a9320986b3
lib.strings: init splitStringBy (#385643) 2025-04-23 04:51:38 +00:00
Silvan Mosberger 3ca8b685c8 lib.getAttrFromPath: fix docs 2025-04-22 23:39:18 +02:00
Zitrone 6638639684
font-util: refactored, moved to pkgs/by-name and renamed from xorg.fontutil 2025-04-22 19:46:53 +02:00
Zitrone 5d15a3d718
font-alias: refactored, moved to pkgs/by-name and renamed from xorg.fontalias 2025-04-22 19:46:52 +02:00
Norbert Melzer b2f1b6b8f0
lib/strings: Zero‐pad hex digits in escapeC (#399722) 2025-04-21 17:12:55 +02:00
Johannes Kirschbauer 843af863e6
lib.options.mkPackageOption: use lib.showAttrPath (#398066) 2025-04-21 10:51:01 +02:00
Johannes Kirschbauer 013beed1db
lib/types: check paths in pathWith with hasStorePathPrefix (#387304) 2025-04-21 10:45:23 +02:00
Mikael Voss 487a002c63
lib/strings: Zero‐pad hex digits in escapeC
lib.strings.escapeC produces single‐digit hexadecimal strings for
character values ≤ 15, which results in an ambiguity. If the following
character is a hex digit, it will be interpreted as being part of the
escape sequence.

systemd, which also relies on C‐style escape sequences, does not
decode single‐digit sequences at all, even if unambiguous.

Padding the hexadecimal string with "0" avoids this problem.
2025-04-18 13:41:53 +02:00
Thiago Kenji Okada 4a99dd0542
grayjay: init at 5 (#368427) 2025-04-18 11:53:55 +01:00
Robert Hensing 38bb05d169 lib.modules: Add prefix to imports type check error 2025-04-15 13:42:29 +02:00
Robert Hensing ce0c6e269d lib.modules: Typos 2025-04-15 12:42:47 +02:00
Robert Hensing 4752577dd6 lib.modules: Add _prefix module argument 2025-04-15 12:42:47 +02:00
Matt Sturgeon 6107d48bcb
lib.options.mkPackageOption: use lib.showAttrPath
Make use of `lib.showAttrPath` instead of manually doing `concatStringsSep "."`.

This means edge-cases such as the attr-path including names that are not
valid nix identifiers will be handled better.

See:
- https://nix.dev/manual/nix/2.26/language/identifiers
- https://nixos.org/manual/nixpkgs/unstable/#function-library-lib.attrsets.showAttrPath
2025-04-13 20:54:13 +01:00
Matt Sturgeon 4c26f96059
lib/tests/modules: test all mkPackageOption cases
There were several test case options declared in `declare-mkPackageOption.nix`
that were not actually tested in `modules.sh`.
2025-04-13 20:54:12 +01:00
azahi 9fee9e7371
lib.takeEnd: init 2025-04-13 17:37:35 +03:00
K900 aece6a0c1f Merge remote-tracking branch 'origin/master' into staging-next 2025-04-11 21:17:42 +03:00
Robert Hensing 3e5af839c2
lib.types.submodule: Disable check during docs generation (#396907) 2025-04-11 19:12:32 +02:00
Alyssa Ross 904b79c696
lib.systems: force qemuArch to "aarch64" on aarch64
qemu architecture names are fixed — we're using uname here just
because it's more likely to be correct than CPU name (see e.g. POWER).
This means that aarch64 is always called aarch64, even on Darwin where
uname reports arm64.

Fixes: 61582c7043 ("lib/systems: use Darwin architecture names for `config` and `uname`")
2025-04-11 10:32:19 +02:00
nixpkgs-ci[bot] c55a1a7779
Merge master into staging-next 2025-04-11 00:15:47 +00:00
Robert Hensing e09cf9f066 lib.types.submodule: Disable check during docs generation
Put simply docs generation is a weird eval, and we should avoid
generating any unnecessary errors.
2025-04-11 00:32:01 +02:00
Robert Hensing d84b0024f6
lib/modules: export class inside specialArgs (#395141) 2025-04-10 20:58:41 +02:00
Michael Hoang 6de9039315 lib/modules: add class to specialArgs
Co-Authored-By: Johannes Kirschbauer <hsjobeki@gmail.com>
2025-04-10 17:58:40 +02:00
nixpkgs-ci[bot] 6c98e107c7
Merge master into staging-next 2025-04-09 00:15:45 +00:00
Jörg Thalheim abd52dd872 nixVersions.{nix_2_28,nix_2_26}: switch simplified meson build
So we are adding a simplified version that builds a monolithic nix binary to get finished
in time for the release. Afterwards we will switch to the modular build again.
2025-04-08 12:29:11 -04:00
Heitor Augusto bb4be9a474
lib.strings: init splitStringBy 2025-04-07 15:51:18 -03:00
K900 b3146d4446 Merge remote-tracking branch 'origin/master' into staging-next 2025-04-07 21:21:10 +03:00
Johannes Kirschbauer 0196e5372b
lib/modules: Init lib.mkDefinition (#390983) 2025-04-07 14:52:48 +02:00
K900 05bc93a58a Merge remote-tracking branch 'origin/master' into staging-next 2025-04-06 11:20:16 +03:00
Maciej Krüger 1000bcdd4d
lib.systems: Add arm-embedded-nano (#392204) 2025-04-06 00:10:57 +02:00
samfundev 62f3255cd8
lib/licenses: add sfl 2025-04-03 21:37:32 -04:00
Johannes Kirschbauer 33daa3f4b9
lib.modules: init test for lib.mkDefinition 2025-04-03 15:03:00 +02:00
Robert Hensing b42b9e061b
lib.modules: init lib.mkDefinition
Free-floating definitions including file location.
2025-04-03 14:12:07 +02:00
Emily 61582c7043 lib/systems: use Darwin architecture names for config and uname
`aarch64-apple-darwin` no longer works with LLVM 20.
2025-04-02 21:22:47 +01:00
Emily 1e6ab3434f treewide: drop support for 32‐bit Darwin
It’s dead, Jim.
2025-04-02 21:20:44 +01:00
nixpkgs-ci[bot] d05ee1c1cb
Merge staging-next into staging 2025-04-02 16:38:11 +00:00
Silvan Mosberger e52d633a63 Merge remote-tracking branch 'upstream/staging-next' into staging 2025-04-02 18:30:54 +02:00
Mikael Voss 77b4dedbfc lib/systems/architecures: Add generic inferiors for x86-64 AMD 2025-04-02 14:43:21 +02:00
Mikael Voss 998f1652fb lib/system/architectures: Correct Alder Lake inferiors 2025-04-02 14:43:21 +02:00
Mikael Voss e693be89e7 lib/systems/architectures: Define inferiors for common ARM64 CPUs 2025-04-02 14:06:27 +02:00
Mikael Voss 387a5561fb lib/systems/architectures: Define generic ARM64 inferiors 2025-04-02 14:06:27 +02:00
Mikael Voss 931f464581
lib/types: check paths in pathWith with hasStorePathPrefix
This permits usage of content‐addressed derivations and has the added
benefit of checking normalised paths.
2025-04-02 13:28:52 +02:00
Mikael Voss bf790d1a7f
lib/path: properly handle /. in hasStorePathPrefix 2025-04-02 13:26:43 +02:00
Silvan Mosberger 374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
K900 a6d5666400 Merge remote-tracking branch 'origin/staging-next' into staging 2025-04-01 08:39:50 +03:00
Robert Hensing d2c9829366
lib.modules: simplified logic in usage of zipAttrsWith and minor cleanup (#388748) 2025-04-01 00:48:56 +02:00
nixpkgs-ci[bot] 86e22e1e80
Merge staging-next into staging 2025-03-31 12:06:34 +00:00
Robert Hensing bb984408d5 lib/tests/release.nix: Use nix.overrideScope for >=2.26 2025-03-31 00:47:37 +02:00
Tristan Ross 5e51e2645a
llvmPackages_{12,13,14,15,16,17,18,19,20,git}.llvm: refactor (#389873) 2025-03-29 14:23:57 -07:00