Commit Graph

1214 Commits

Author SHA1 Message Date
Pol Dellaiera
65a333600d treewide: replace rev with tag 2025-04-07 16:57:22 +02:00
Wolfgang Walther
9e296dcf84 Merge commit '3b48b2eb41f0bcd2c0551cd1c2457fdae806c7a3' into haskell-updates-merge-nixfmt 2025-04-05 14:19:34 +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
Wolfgang Walther
b660909f3c Merge commit '2a6f5e82097461c4adaa93b6e84672badbdd4460' into haskell-updates 2025-03-29 11:43:35 +01:00
Vincenzo Mantova
43d524e00e texlive: 2024-20241027 -> 2024-final (#390498) 2025-03-24 02:31:21 -04:00
Thomas Miedema
ff9e4bce32 haskell: fix shellFor test
In #296645, envFunc (and thus shellFor) was changed from
`mkDerivation {phases=[..]}` to `runCommand ..`. So since
then, the derivation of shellFor contains a `buildCommand`
("echo $nativeBuildInputs $buildInputs > $out"),
and as a result the custom phases defined in shellFor's
test were ignored.
2025-03-23 01:39:43 +01: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
Peder Bergebakken Sundt
5aba99242e treewide: fix typos in comments
Made with

```shell
git restore .
fd '\.nix$' pkgs/ --type f -j1 -x bash -xc "$(cat <<"EOF"
    typos --no-check-filenames --write-changes "$1"
    git diff --exit-code "$1" && exit
    #( git diff "$1" | grep -qE "^\+ +[^# ]") && git restore "$1"
    count1="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> ' | wc -l )"
    count2="$( bat --language nix --diff --style changes "$1" --theme "Monokai Extended" --color always | aha --no-header | grep -E '^<span style="color:olive;">~</span> (<span style="color:#f8f8f2;"> *</span>)?<span style="color:#75715e;">.*</span>$' | wc -l )"
    [[ $count1 -ne $count2 ]] && git restore "$1"
EOF
)" -- {}
```

and filtered with `GIT_DIFF_OPTS='--unified=15' git -c interactive.singleKey=true add --patch`

I initially tried using the tree-sitter cli, python bindings and even ast-grep through various means, but this is what I ended up with.
2025-02-24 10:44:41 +01:00
nixpkgs-ci[bot]
97b9d455ea Merge master into staging-next 2025-02-12 12:05:57 +00:00
sternenseemann
f611c803e5 tests.haskell.upstreamStackhpackVersion: set descriptive user agent
GitHub apparently immediately terminates the connection for our previous
bogus curl user agent. Let's be more polite about this (default curl
user agent would work, too).
2025-02-11 22:48:14 +01:00
Wolfgang Walther
2e43b87c62 replaceVars: fail when exemption can't be found
This also changes stdenv's substitute --replace-fail to error out when
the replacement is the same as the search pattern, but can't be found.
This should not cause any problems in existing code, from what I can
tell from grepping nixpkgs.

The exception for pattern==replacement was previously introduced all the
way back in 5ff872aa24, but this was
apparently only used to make the check for the warning "simpler".
2025-02-10 19:19:59 +01:00
K900
13b8408f30 Merge remote-tracking branch 'origin/staging-next' into staging 2025-02-06 17:10:14 +03:00
Jörg Thalheim
63a327bd87 rust/hooks: move tests to hooks and add to passthru (#379269) 2025-02-06 05:28:37 +01:00
K900
56c60b2c97 Merge remote-tracking branch 'origin/master' into staging-next 2025-02-05 17:42:52 +03:00
Robert Hensing
692a57e61d Revert "Reapply "pkgs/top-level: make package sets composable""
This reverts commit d2faa1bbca.
2025-02-05 14:29:11 +01:00
DavHau
154f977ac6 rust/hooks: move tests to hooks and add to passthru 2025-02-04 12:02:15 +07:00
nixpkgs-ci[bot]
0acbe87d4f Merge staging-next into staging 2025-02-02 11:33:22 +00:00
nixpkgs-ci[bot]
e1353d0d8d Merge master into staging-next 2025-02-02 11:32:53 +00:00
Jörg Thalheim
c8b5329e7a rust: fix splicing for rust hooks (#369424) 2025-02-02 00:48:20 +07:00
Wolfgang Walther
d2faa1bbca Reapply "pkgs/top-level: make package sets composable"
This reverts commit 7c251e2b5f.

Left out eec21001b0, which changed
nixos/nixpkgs, doing it differently this time.
2025-02-01 12:04:59 +01:00
DavHau
db4cf6cb1d rust: fix splicing for rust hooks
This fixes a long standing issue where rust hooks behave differently when used inside buildRustPackage vs inside mkDerivation, which lead to surprising behavior, like for example the package being built for the wrong paltform or the linker not being found especially in cross compilation scenarios.

The reason for this inconsitency was, that buildRustPackage consumed the hooks in a non-spliced form, via [this inherit statement](4506ece030/pkgs/development/compilers/rust/make-rust-platform.nix (L60)), and therefore the usual platform shift on the hooks introduced by putting them in `nativeBuildInputs` was not applied here.

Thoug whenever the hook was used inside other builders like `mkDerivation` the platform shift did apply correctly as the hook was consumed via the spliced package set, introducing the inconsitecy.

Because of the wrong (non-spliced) use in buildRustPackage, most rust hooks have been designed with the wrong build/host/target shift in mind which is fixed by this change.

Due to the inconsitent behavior between different builders, workarounds like `rust.envVars`, which were previously introduced, likely become obsolete by this change.

This likely fixes a bunch of cross compilation issues for rust packages that are not based on `buildRustPackage` but instead consume the hooks directly.

Done:
- ensure that `buildRustPackage` consumes spliced hooks by using makeScopeWithSplicing' in make-rust-platform.nix.
- refactor hooks to make them refer to correct build/host/target packages.
- remove `rust.envVars` workaround from all rust hooks
- implement tests for most rust hooks in /pkgs/test/rut-hooks

The newly added tests can be executed for native as well as cross compilation via:
```
nix-build -A tests.rust-hooks -A pkgsCross.riscv64.tests.rust-hooks
```
2025-01-31 18:18:46 +07:00
K900
7c251e2b5f Revert "pkgs/top-level: make package sets composable" 2025-01-26 09:43:44 +03:00
Wolfgang Walther
2acca93bef pkgs/top-level: fix composing "native cross" package sets
When using pkgsCross with a system that ends up the same as the
localSystem, then modifications for package sets like pksgMusl need to
be done for **both** localSystem and crossSystem. Consider the following
on x86_64-linux:

  pkgsCross.gnu64.pkgsMusl

Before this change, this would result in a musl buildPlatform, but a gnu
hostPlatform. This breaks the promise of "stacking" package sets on top
of each other.

After this change, it results in a musl buildPlatform and a musl
hostPlatform. This works better.

One could expect this to result in the same as pkgsCross.musl64, i.e. a
gnu buildPlatform and a musl hostPlatform, however I couldn't get this
to work without increasing memory usage for ci/eval by many, many GB.
This is caused by usage of pkgsi686Linux inside the main package set,
which follows the same hybrid pattern.
2025-01-25 18:58:09 +01:00
Wolfgang Walther
01a02e41f7 pkgs/top-level: make package sets composable
The various pkgsXYZ top-level package sets did not pass localSystem /
crossSystem to lower levels, so far. This change propagates original
arguments to lower levels, which include the overrides made by an upper
package sets.

There is an extensive test-suite to test various combinations of package
sets in pkgs/test/top-level. There are a few basic promises made:

- Package sets must be idempotent. pkgsMusl.pkgsMusl === pkgsMusl.

- Once pkgsCross is used any subsequent package sets should affect the
  **host platform** and not the build platform. Examples:
  - pkgsMusl.pkgsCross.aarch64-multiplatform is a cross compilation from
musl to glibc/aarch64
  - pkgsCross.aarch64-multiplatform.pkgsMusl is a cross compilation to
musl/aarch64

- Modifications from an earlier layer should not be lost, unless
  explicitly overwritten. Examples:
  - pkgsStatic.pkgsMusl should still be static.
  - pkgsStatic.pkgsCross.gnu64 should be static, but with glibc instead
of musl.

Exceptions / TODOs:
- pkgsExtraHardening is currently not idempotent, because it applies the
  same flags over and over again.

Supersedes #136549
Resolves #114510
Resolves #212494
Resolves #281596
2025-01-25 18:55:03 +01:00
Wolfgang Walther
b75355ccc3 pkgs/test/top-level: add tests for package set composability
This adds some basic tests to compose package sets. The cases that are
currently broken
are commented out, they include things like:

- pkgsStatic.pkgsMusl losing the isStatic flag
- pkgsCross.ppc64-musl.pkgsMusl losing the gcc.abi setting
- pkgsCross.mingwW64.pkgsStatic losing the config string
- pkgsLLVM.pkgsMusl losing the useLLVM flag
- pkgsLLVM.pkgsStatic losing the useLLVM flag
- pkgsLLVM.pkgsi686Linux losing the useLLVM flag

And probably more.
2025-01-25 18:55:00 +01: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
Philip Taron
9e56333a3b stdenv: add no-broken-symlinks hook (#370750) 2025-01-22 17:14:11 -08:00
Connor Baker
51b2764e9f no-broken-symlinks: provide only dontCheckForBrokenSymlinks and test against absolute symlinks 2025-01-22 11:05:13 -08:00
Philip Taron
b83e120344 lib.extendMkDerivation: init (#234651)
It's not the longest-open PR (May 28, 2023 -> Jan 22, 2025) but it took a while. This PR introduces a unified approach to implementing build helpers that support fixed-point arguments and bring such support to existing build helpers.
2025-01-22 05:10:25 -08:00
Connor Baker
229fdf0cf2 test.stdenv.hooks.no-broken-symlinks: init 2025-01-21 17:35:14 -08:00
Wolfgang Walther
d07168dccb tests.replaceVars.replaceVarsWith: fix
This never worked properly, but it does now.
2025-01-21 20:12:26 +01:00
Yueh-Shun Li
2439ead791 lib.extendMkDerivation: init
Add functions extendMkDerivation to lib.customisation.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
Co-authored-by: Lin Jian <me@linj.tech>
Co-authored-by: Philip Taron <philip.taron@gmail.com>
2025-01-18 14:20:45 +08:00
github-actions[bot]
9129b13110 Merge master into staging-next 2025-01-15 00:14:20 +00:00
Robert Hensing
bfefff9651 nixos-render-docs: Support explicit anchors in markdown for optional compatibility with the HTML renderer (#370352) 2025-01-14 23:10:41 +01:00
Silvan Mosberger
6ad7602ef9 tests.overriding: format with nixfmt-rfc-style and categorize (#366583) 2025-01-14 19:08:23 +01:00
github-actions[bot]
bccd5433ad Merge master into staging-next 2025-01-07 00:15:12 +00:00
Emily
42de2bcb35 cc-wrapper hardeningFlags tests: add tests for pacret, shadowstack (#331596) 2025-01-07 00:01:28 +00:00
Robert Hensing
e2078ef31e tests.nixosOptionsDoc: init 2025-01-02 22:42:05 +01:00
K900
ca300e32f7 Merge remote-tracking branch 'origin/staging-next' into staging 2025-01-01 10:07:33 +03:00
Emily
77def225cb tests.haskell.setBuildTarget: avoid lib.fileset 2024-12-31 02:30:18 +00:00
Emily
f6cc18e0e4 tests.haskell.cabalSdist: avoid lib.fileset 2024-12-31 02:30:18 +00:00
Emily
6ff076b1b1 tests.makeBinaryWrapper: avoid lib.fileset 2024-12-31 02:30:18 +00:00
Yueh-Shun Li
9e66d6ce58 tests.overriding: restructure and categorise by test targets
Split tests in the let-in block into
tests-stdenv, tests-go, and tests-python.

Place the dependent variables into the let-in block of each category.

This chore commit causes no rebuilds.
2024-12-19 22:33:31 +08:00