81 Commits

Author SHA1 Message Date
nixpkgs-ci[bot] 9af8e8ea80 Merge master into staging-next 2026-02-20 18:13:26 +00:00
Emily 36e1dea26b tests.stdenv: extend the existing config 2026-02-19 16:07:57 +00:00
Aleksi Hannula 3b2053bc5e tests.stdenv: fix remaining patch-shebangs tests 2026-01-26 21:45:18 +02:00
dish 44c0cd2165 tests.stdenv: fix preserves-binary-data test 2026-01-26 21:45:18 +02:00
Aleksi Hannula 5500570e9f stdenv: refactor to hook up minimal-bootstrap 2026-01-26 21:45:18 +02:00
jopejoe1 9e568d613d tests.stdenv: migrate tests-stdenv-gcc-stageCompare from all-packages 2026-01-16 20:31:57 +01:00
nixpkgs-ci[bot] 6b5a50c011 Merge staging-next into staging 2025-12-13 06:06:37 +00:00
Taeer Bar-Yam 97c3645990 stdenv: add tests for inputDerivation with allowedReferences, etc.
Co-authored-by: infinisil <github@infinisil.com>

!fixup every test needs a meta field?

!fixup refactor inputDerivation tests

!fixup fix tests
2025-12-12 20:23:22 +01:00
K900 8b56bf20bb Merge remote-tracking branch 'origin/staging-next' into staging 2025-12-07 23:38:37 +03:00
David McFarland d613d20a13 treewide: fix nix-env eval in cross 2025-12-04 19:44:19 -04:00
DavHau c66b12ff90 make-symlinks-relative.sh: optimize - use multiple cores
This optimizes the performance of the hook on machines with multiple cores.

The previous implementation was slow, as it was launching two extra processes per symlink (readlink and ln) while not making use of multiprocessing.

The following improvements were made:
- don't even execute the hook if dontRewriteSymlinks is set
- replace multiple find calls with single find call over all outputs
- use xargs -P to process symlinks in parallel
- add test to check that the hook operates as expected
2025-12-03 11:39:52 +07:00
Connor Baker d9dbfc0a6c tests.stdenv: use system from stdenv.{build,host}Platform
Signed-off-by: Connor Baker <ConnorBaker01@gmail.com>
2025-09-30 15:23:18 -07:00
Wolfgang Walther 535b720589 Merge branch 'master' into staging-next 2025-07-24 14:27:50 +02:00
Wolfgang Walther 5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
nixpkgs-ci[bot] 592851927b Merge master into staging-next 2025-07-22 00:18:36 +00:00
Wolfgang Walther 3ea96163cc tests-stdenv-gcc-stageCompare: delay asserts
The removed assert is covered by `meta.platforms = linux`, which will
throw an "unsupported system" error on darwin. Since the platforms are
restricted to linux anyway, it doesn't make sense to have this set to
`all` in `release-small.nix` - `linux` should suffice. Right?

The other assert is delayed until after the evaluation of `meta`. This
allows the "unsupported system" error on darwin to be thrown at all,
without triggering the assert before. This helps CI, which can't catch
asserts properly, but can do so with `meta.platforms` based errors.
2025-07-21 19:23:43 +02:00
nixpkgs-ci[bot] c1cb68b31d Merge master into staging-next 2025-07-19 00:18:05 +00:00
langsjo e432d5321e tests.stdenv: drop "test-env-derivation"
This behavior is no longer supported
2025-07-18 11:21:52 -07:00
DavHau a1154d6348 patch-shebangs: fix binary data corrupt after patching
This removes the recently introduced shell based implementation of `sponge` which wasn't capable of managing binary input.

Now, a tmpFile under $TMPDIR is created manually and later deleted

see: https://github.com/NixOS/nixpkgs/pull/414448#issuecomment-3041238623
2025-07-07 14:57:21 +07:00
DavHau f2f55c5267 patchShebangs: add more tests
- Add test to ensure ability to patch read-only-files (see https://github.com/NixOS/nixpkgs/pull/414448#issuecomment-3016010151)
- Add test to ensure the timestamp is preserved
- Add test to ensure read-only permissions are preserved
2025-07-01 12:43:26 +07:00
DavHau 4a42314f72 generic-builder: optimize - reduce execve calls when sourcing
This improves the implementation of `dumpVars` by removing a call to `install`.

This improves performance when sourcing setup.sh by more than 10%
It should also improve the performance when transitioning between build phases significantly as no process executions are issued anymore,

A test is added, which ensures that no extra execve calls are issued while sourcing setup.sh.
2025-06-16 22:21:39 +07:00
jopejoe1 b494b7ed40 tests.stdenv: remove __attrsFailEvaluation
These attrs do not fail to Eval on Darwin anymore
2025-05-13 20:32:18 +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](https://github.com/NixOS/nixpkgs/tree/8616af08d915377bd930395f3b700a0e93d08728/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
Rhys-T 0f17943751 noBrokenSymlinks: apply lib.recurseIntoAttrs to set of tests
For consistency with the outer `tests.stdenv.hooks` attrset.
2025-03-05 15:49:22 -05:00
Rhys-T 0354b63bf9 noBrokenSymlinks: use lib.optionalAttrs instead of meta.badPlatforms
Having unbuildable tests in the attrset makes it difficult to ask Nix to
build all the working ones at once. See discussion in #380683. So
instead of flagging them, let's just remove them entirely.
2025-03-05 15:46:38 -05:00
Rhys-T 18d92cd065 noBrokenSymlinks: set meta.badPlatforms for tests
Some platforms implement permissions for symlinks, while others -
including Linux - ignore them. As a result, testing this hook's handling
of unreadable symlinks requires careful attention to which kind of
platform we're on. See the comments by `meta.badPlatforms` for details.
2025-03-05 15:46:38 -05:00
Rhys-T 0c4f6e939d noBrokenSymlinks: move hook to beginning of defaultNativeBuildInputs
This protects the rest of the standard setup hooks from unreadable and
other broken symlinks. (Otherwise, they can choke on the `readlink` step
and fail silently before `no-broken-symlinks.sh`` is even reached.)
2025-03-05 15:46:38 -05:00
Rhys-T 43178a462f noBrokenSymlinks: fix tests on Linux
`mkUnreadableSymlink` was exiting before the hook could print its
messages, meaning that the combined 'broken' test wasn't getting the
symlink counts.
2025-03-05 15:46:37 -05:00
Rhys-T 1a9fd7866b noBrokenSymlinks: use umask instead of chmod to make unreadable symlinks
The stage2 stdenv uses Coreutils 9.4, which doesn't have `chmod -h` yet.
2025-03-05 15:46:37 -05:00
Rhys-T 693c7b3dad noBrokenSymlinks: add test for unreadable symlinks; fix existing tests 2025-03-05 15:46:37 -05:00
Connor Baker 1166b63c1d test.stdenv.hooks.no-broken-symlinks: correct inverted absolute path option 2025-01-24 16:29:48 +00:00
Connor Baker b2416f4485 no-broken-symlinks: restrict checks to symlinks pointing inside the store 2025-01-23 15:59:18 -08:00
Connor Baker 51b2764e9f no-broken-symlinks: provide only dontCheckForBrokenSymlinks and test against absolute symlinks 2025-01-22 11:05:13 -08:00
Connor Baker 229fdf0cf2 test.stdenv.hooks.no-broken-symlinks: init 2025-01-21 17:35:14 -08:00
github-actions[bot] 8c5656aa89 Merge master into staging-next 2024-12-15 00:17:27 +00:00
sternenseemann a0a35b6c24 Fix cross eval issues (#362546) 2024-12-14 22:14:52 +01:00
Artturin 653b3558ee tests-stdenv-gcc-stageCompare: Fail gracefullyier
Don't fail with a missing attribute error, so the error can be handled.
2024-12-10 23:49:29 +02:00
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Silvan Mosberger 84d4f874c2 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build https://github.com/infinisil/treewide-nixpkgs-reformat-script/archive/a08b3a4d199c6124ac5b36a889d9099b4383463f.tar.gz \
      --argstr baseRev 78e9caf153
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:23:58 +01:00
Wolfgang Walther 56b09628e3 stdenv: support multi-char separators in concatStringsSep
One prominent use-case for this is pytestCheckHook. This will help
making it work with structuredAttrs in the future.
2024-11-30 16:38:02 +01:00
Artturin f0e657f3b1 Merge branch 'master' into staging-next 2024-09-25 06:05:01 +03:00
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00
Wolfgang Walther bc0395ee6f auto-patchelf: refactor structuredAttrs support
stdenv now provides better tooling to support structuredAttrs without
depending on $__structuredAttrs itself.
2024-09-11 19:29:39 +02:00
Philip Taron 0d1b26857b treewide: support structuredAttrs in setup hooks (part 2) (#335666) 2024-08-28 14:07:58 -07:00
Artturin 740804dd5f patch-shebangs: don't patch shebangs with bash builtins (#330188) 2024-08-27 03:54:10 +03:00
Wolfgang Walther 1efcffa700 stdenv: support default values in concatTo
The previously used pattern was introduced in #318614, but technically
leaked the default flags into the global scope. While this would
probably not make much of a practical difference, making concatTo
support default values is a much cleaner approach.
2024-08-24 12:23:35 +02:00
Someone Serge 9876c2fe9e stdenv: concatStringsSep: test sep="&"
The test fails without 64eaa63181
("stdenv: concatStringsSep: quote ${sep}")

Co-authored-by: Ivan Trubach <mr.trubach@icloud.com>
Co-authored-by: Wolfgang Walther <walther@technowledgy.de>
2024-08-11 23:54:15 +00:00
Wolfgang Walther 471cbdd062 stdenv: add concatStringsSep helper
This can be used to separate lists for example with commas, when
creating argument strings. This works with both structuredAttrs disabled
and enabled.
2024-08-02 22:11:41 +02:00
Wolfgang Walther 6bdfef9d2d stdenv: generalize _accumFlagsArray to concatTo
Passing "flagsArray" as the first argument allows using this function
in a few more places.
2024-08-02 22:11:38 +02:00
Wolfgang Walther 929db7bc22 tests.stdenv: fix spelling 2024-08-02 21:54:25 +02:00