Commit Graph

4742 Commits

Author SHA1 Message Date
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