Commit Graph

160 Commits

Author SHA1 Message Date
Ben Siraphob
b5e73a0b2d pkgs: fix typos in stdenv, build-support, top-level and test
Assisted-by: Claude Code (claude-opus-5)
2026-08-02 11:15:27 -07:00
nixpkgs-ci[bot]
aac49c0eff Merge master into staging-next 2026-07-02 00:44:19 +00:00
Silvan Mosberger
bf80cf0f2e ci/eval: Allow disallowed attrs to depend on other disallowed attrs
With a dependency chain like

    a -> b -> c

it was not possible to e.g. add a `meta.problems.removal` to b, because that would cause b to be entirely unavailable as a dependency.

This PR slightly lifts that restriction by allowing both a and b to be marked with such a problem without causing a CI failure.

This is useful for:
- Having a problem on a package that needs to be removed but still has dependents (which then also need a problem)
- Having a problem on a package that is aliased under another attribute, which counts as a dependency
2026-06-30 16:12:39 +02:00
Martin Weinelt
9ade44f1d4 Merge remote-tracking branch 'origin/staging' into staging-next
Conflicts:
- pkgs/top-level/nixpkgs-basic-release-checks.nix
2026-06-27 01:13:12 +02:00
Silvan Mosberger
a90d993610 ci/eval: Allow preventing internal Nixpkgs use of certain problem kinds 2026-06-24 12:26:03 +02:00
Silvan Mosberger
7cc4d7dea8 config: Introduce attrPathsDisallowedForInternalUse
This is very similar to how the aliases.nix overlay can be removed to
prevent usage of them in Nixpkgs itself, but this config attribute
allows preventing use of other existing attributes in Nixpkgs.

Needed for a follow-up commit.
2026-06-24 12:25:54 +02:00
Aliaksandr
cafb9bdee9 stdenv: distinguish stdenvNoCC name from stdenv
The default stdenvNoCC is constructed via stdenv.override and inherited
the parent stdenv's name verbatim. Every bootstrap stage thus produced
two derivations with identical names (one with a C compiler, one
without), which made bootstrap traces and per-stage drv counts
ambiguous.

Appending '-no-cc' makes each stage's stdenv/stdenvNoCC pair uniquely
identifiable in store paths and graph traces.
2026-06-01 00:11:39 +03:00
Philip Taron
e03d0a783d various: reduce // merges, optimize ++ chains across hot paths (#506793) 2026-05-27 22:06:37 +00:00
Ryan Burns
f2c799c9df pkgsStatic: make pkgsMusl a no-op
When pkgsStatic is already musl, we can let pkgsMusl simply be a no-op.
As the interaction of pkgsStatic and pkgsMusl machinery is currently
broken, this fixes pkgsStatic.pkgsMusl.stdenv.
2026-05-18 16:35:06 -07:00
Aliaksandr
702420055d top-level/stage: replace // optionalAttrs with nullable attr names
Convert 2 optionalAttrs: Darwin extraBuildInputs in stdenvNoCC
override, and !isSupported stdenv override in pkgsi686Linux.
2026-05-18 03:54:27 +03:00
Jonas Chevalier
6ed003c564 appendOverlays: preserve splicing on empty overlay list (#501313) 2026-04-07 14:19:48 +00:00
Emily
11b761e60d pkgsi686Linux: force i686-linux on unsupported platforms
Otherwise we end up evaluating into `i686-darwin` in CI…
2026-03-27 21:37:51 +00:00
Wolfgang Walther
e07663a621 top-level/stage: assert no by-name overwrites
This asserts that no by-name packages are overwritten by definitions in
all-packages.nix.
2026-03-20 16:59:19 -04:00
DavHau
99ab2550e7 appendOverlays: return spliced packages on empty overlay list
`appendOverlays []` returned `self` (the unspliced inner fixpoint)
while `import nixpkgs {}` returns `pkgs.__splicedPackages` (the
spliced version). This caused `pkgs.makeWrapper` and similar
spliced packages to lose their `__spliced` attribute after passing
through `appendOverlays`, breaking cross-compilation in NixOS
modules.

The NixOS `nixpkgs.nix` module calls `cfg.pkgs.appendOverlays
cfg.overlays`, and when no overlays are defined, the empty-list
short-circuit returned unspliced packages. This meant
`nativeBuildInputs = [ pkgs.makeWrapper ]` in NixOS modules would
evaluate the host-platform makeWrapper (which throws in cross
context) instead of being spliced to buildPackages.makeWrapper.

Fix by returning `self.__splicedPackages` instead of `self` for
the empty-list case.
2026-03-19 22:05:32 +08:00
Tobias Mayer
4c05f197e6 lib.systems: s/makeMuslParsedPlatform/mkMuslSystem/ 2026-03-06 23:38:09 +01:00
Tobias Mayer
4cd3967a68 lib.systems: expose makeMuslParsedPlatform
Moving this helper from pkgs/stdenv/stage.nix so it can be used
for alternative variations of pkgsMusl and pkgsStatic.
2026-02-14 23:09:33 +01:00
quantenzitrone
233631a84f treewide: remove references to the xorg namespace in pkgs (manual)
this was done manually, fixing the eval and any remaining stuff of the previous commit

together with the previous commit this shouldn't create any rebuilds
2026-01-25 22:28:14 +01:00
Wolfgang Walther
91a8fee3aa treewide: remove redundant parentheses
Auto-fixed by nixf-diagnose.
2025-10-05 10:52:03 +02:00
NAHO
c8d4dabc43 pkgs: remove optional builtins prefixes from prelude functions
Remove optional builtins prefixes from prelude functions by running:

    builtins=(
      abort
      baseNameOf
      break
      derivation
      derivationStrict
      dirOf
      false
      fetchGit
      fetchMercurial
      fetchTarball
      fetchTree
      fromTOML
      import
      isNull
      map
      null
      placeholder
      removeAttrs
      scopedImport
      throw
      toString
      true
    )

    fd \
      --type file \
      . \
      pkgs \
      --exec-batch sed --in-place --regexp-extended "
        s/\<builtins\.($(
          printf '%s\n' "${builtins[@]}" |
            paste --delimiter '|' --serial -
        ))\>/\1/g
      "

    nix fmt
2025-10-04 19:02:37 +02:00
Emily
731391c2b9 stdenvNoCC: fix extraBuildInputs on Darwin
Closes: #371465
Fixes: 4928668e21
2025-07-29 16:05:10 +01:00
Wolfgang Walther
612e76db51 pkgsx86_64Darwin: move behind allowVariants
This is already not used in-tree, so should be a variant.
2025-07-24 15:31:04 +02:00
Wolfgang Walther
5a0711127c treewide: run nixfmt 1.0.0 2025-07-24 13:55:40 +02:00
Wolfgang Walther
eb875b4a98 pkgsi686Linux: only throw with aliases enabled
For the regular user, this still throws early whenever an attribute
tries to use `pkgsi686Linux`. For CI, this doesn't throw, but instead
overwrites `mkDerivation` to return only derivations marked as
`meta.broken`. This propagates to all reverse dependencies and allows
filtering out these attributes nicely on unsupported platforms.
2025-07-23 08:52:16 +02:00
Tristan Ross
5d5599f720 pkgs/top-level/stage.nix: fix allowVariants with variants set 2025-07-18 13:57:29 -07:00
Peder Bergebakken Sundt
c77ac9dfc3 treewide: fix typos 2025-06-02 16:07:07 +02:00
Tristan Ross
14386224a1 pkgs/top-level/stage.nix: move most nixpkgs sets to variants 2025-05-17 18:03:57 -07:00
Ben Siraphob
9beafa4d27 Revert "stdenv: add uutils-coreutils stdenv" 2025-05-14 15:32:32 -04:00
Sandro Jäckel
bace9f322a pkgsUutils: init 2025-05-14 18:22:17 +02:00
nixpkgs-ci[bot]
c376a565f9 Merge staging-next into staging 2025-04-24 18:04:57 +00:00
zowoq
0931f4e861 Revert "pkgs/top-level/stage.nix: add pkgsLLVMLibc"
This reverts commit 41b14024d2.
2025-04-24 14:04:25 +10:00
Robert Scott
781b42b87d cc-wrapper: add nostrictaliasing hardening flag support
this equates to -fno-strict-aliasing

this is not a particularly new flag and is supported by all our
gcc and clang versions.

add to pkgsExtraHardening's defaultHardeningFlags.
2025-04-06 12:52:47 +01:00
Silvan Mosberger
e52d633a63 Merge remote-tracking branch 'upstream/staging-next' into staging 2025-04-02 18:30:54 +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
Pavol Rusnak
2925f716f8 rocmPackages: 6.0.2 -> 6.3.3, and various ROCm build fixes and new packages (#367695) 2025-03-24 21:11:47 +01:00
Randy Eckenrode
4928668e21 stdenvNoCC: drop extraBuildInputs on Darwin
Darwin includes its SDK in `extraBuildInputs`, which isn’t needed in
`stdenvNoCC` because it depends on a compiler.  Including it greatly
increases the size of the `stdenvNoCC` closure (by ~1 GiB).

This wasn’t an issue in the past when darwin included CoreFoundation
because CoreFoundation on its own is very small.  Now that it includes
the whole SDK and links some bintools, it pulls in 300~400 MiB for the
SDK plus another ~445 MiB for LLVM.

Fixes #371465
2025-03-24 08:17:31 -04:00
Luna Nova
72a714071e pkgsRocm: add package set with cuda config off, rocm config on 2025-03-19 22:26:48 -07:00
Martin Weinelt
3ebfc6ddcf bintools-wrapper: enable stackclashprotection hardening flag by default (#374893) 2025-02-08 18:16:17 +01: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
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
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
69775e2deb pkgs/top-level: refactor mkHybridPkgs 2025-01-25 18:58:09 +01:00
Wolfgang Walther
ba6262f2eb pkgs/top-level: refactor mkCrossPkgs 2025-01-25 18:58:07 +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
071851299f pkgs/top-level: refactor mkPkgs
Sharing a first piece of common code between all package sets makes it
easier to maintain and less likely to introduce a new package set
without this.
2025-01-25 18:01:45 +01:00
Wolfgang Walther
3fcedef056 pkgs/top-level/stage: refactor moving more generic package sets to the bottom
No change, just move appendOverlays and extend to the bottom, since they
will be changed much less often. This makes it easier to compare the
other package sets side-by-side.
2025-01-25 17:59:54 +01:00
Wolfgang Walther
4e7cc47a22 pkgs/top-level: rewrite some outdated comments
This removes all specific references to pkgsCross or pkgsi686Linux, because
they have become outdated with the addition of many more package sets.
2025-01-25 17:59:54 +01:00
Robert Scott
04791f4a4d bintools-wrapper: enable stackclashprotection by default 2025-01-11 12:31:08 +00:00
Tristan Ross
41b14024d2 pkgs/top-level/stage.nix: add pkgsLLVMLibc 2025-01-10 20:54:19 -08:00
Peter Waller
a4543ae1bc pkgsLLVM: Fix unwanted target offset
pkgsLLVM introduced an unwanted target offset, as can be seen with the
following commands.

Before this commit:

```
$ nix eval --system x86_64-linux -f . pkgsCross.aarch64-multiplatform.buildPackages.stdenv.hostPlatform.config
"x86_64-unknown-linux-gnu"
$ nix eval --system x86_64-linux -f . pkgsCross.aarch64-multiplatform.buildPackages.pkgsLLVM.stdenv.hostPlatform.config
"aarch64-unknown-linux-gnu"

Explaination: These two should be the same, since the only difference
between them is the addition of "pkgsLLVM". The buildPackages of the
pkgsCross set should have a hostPlatform which is the native platform.
```

After this commit:

```
$ nix eval --system x86_64-linux -f . pkgsCross.aarch64-multiplatform.buildPackages.stdenv.hostPlatform.config
"x86_64-unknown-linux-gnu"
$ nix eval --system x86_64-linux -f . pkgsCross.aarch64-multiplatform.buildPackages.pkgsLLVM.stdenv.hostPlatform.config
"x86_64-unknown-linux-gnu"
```
2024-12-10 09:01:31 +00:00