Commit Graph

322 Commits

Author SHA1 Message Date
Aliaksandr
4bb4cff368 stdenv: deprecate is* aliases in favor of hostPlatform.is*
These shorthands hide the platform distinction and are unfit for
cross-compilation. Wrap them in `lib.warn` so each access prints a
deprecation notice, and gate them on `config.allowAliases` so they
can be removed entirely.

Assisted-by: claude-code with claude-opus-4-8
2026-08-12 20:27:09 +02:00
Eman Resu
159a6daf6b stdenv/generic: memoise passing config to mkDerivation unless overriden 2026-05-29 16:51:25 -04:00
Eman Resu
2c9c2fd429 stdenv/generic: store default native build inputs outside of stdenv 2026-05-28 19:34:54 -04:00
Eman Resu
4e54346578 make-derivation.nix: take args one at a time, declare variables early
While bootstrapping stdenv, we'd prefer not to call the entire file the
whole time on every single stage, since we have certain args ahead of
time.
2026-05-28 19:34:51 -04:00
Philip Taron
e03d0a783d various: reduce // merges, optimize ++ chains across hot paths (#506793) 2026-05-27 22:06:37 +00:00
Aliaksandr
a42becdd92 stdenv/generic: replace // optionalAttrs with nullable attr names
Convert 3 optionalAttrs in the stdenv derivation call to nullable
attribute names: allowedRequisites, contentAddressedByDefault, and
isDarwin sandbox/impureHostDeps.
2026-05-18 03:54:26 +03:00
jopejoe1
d3ab010c1f treewide: replace lib.trivial.release with hardcode version (hack)
This is not the actual version we want to hardcode here, but due to the upcomming branch-of we need this version to not beaffected by the release version, but it also needs to stay exatly the same as we do not want to rebuild `stdenv` anymore post branch-of.
2026-05-08 10:36:52 +02:00
Sigmanificient
d6a6df6661 stdenv: set meta.{position,license,teams,identifiers.cpeParts}
Co-authored-by: Tristan Ross <tristan.ross@determinate.systems>
2026-04-22 10:36:15 +02:00
jopejoe1
335f2be3c5 treewide: replace lib.trivial.version with lib.trivial.release
includes a fix that will be reverted in staging
2026-02-16 10:08:36 +01:00
nixpkgs-ci[bot]
585a5786d6 Merge master into staging-next 2026-02-13 00:25:50 +00:00
Fernando Rodrigues
868165d920 stdenv: add pname and version
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
2026-02-03 15:23:30 +11:00
Jason Yundt
eb49ddab47 stdenv: make inputDerivation never require system features
This change removes a limitation with inputDerivations. See
stdenv.tests.inputDerivationRequiredSystemFeatures.meta.longDescription
for details.

I had originally ran into this limitation when trying to write a test
for pull request #319420. That pull request adds a setup hook that can
only be used with derivations that have "uid-range" in their
requiredSystemFeatures. I want to be able to build the inputDerivation
for part of the test on systems that don’t have that system feature.
2025-11-21 09:25:00 -05:00
Ben Siraphob
ed23526c32 pkgs/stdenv: fix typos 2025-09-09 13:14:36 +07:00
DavHau
6b8e23b9f2 Revert "parallelRun, parallelMap: init"
This reverts commit 4d12b83ae0.

The stdin read lock mechnism can cause the whole process pool to lock up
indefinitely
2025-06-10 10:37:35 +07:00
DavHau
4d12b83ae0 parallelRun, parallelMap: init
These bash helpers make it trivial to write shell based setup hooks that utilize all cores.

This also makes it simpler to optimize existing hooks which are not yet utilizing all cores.

Existing hooks which already use `xargs -P` to parallelize their work, can be optimized further by replacing the xargs call with one of the functions added here , eg. `parallelRun` or `parallelMap`.

The new shell based functions `parallelRun` and `parallelMap` are superior to `xargs -P`, because:

- They perform better as they launch $NIX_BUILD_CORE workers, each handling many jobs, vs `xargss -P` usually launches a new process for each job (anything else is difficult to implement nicely with xargs).

- workers can be defined as shell functions, which allows using all declared shell variables and functions inside the worker (e.g isElf or isScript, etc.), vs. `xargs -P` forces the user to create a new shell process, which cannot re-use declared variables and functions.
2025-06-06 00:25:51 +07:00
‮rekcäH nitraM‮
55983f1157 stdenv: Fix typo 2025-04-12 10:00:17 +02: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
Connor Baker
aa1405b6e7 stdenv: add no-broken-symlinks hook 2025-01-21 17:35:14 -08: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 a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
Randy Eckenrode
85f95c56e4 stdenv: elaborate on nature of mass rebuilds
(cherry picked from commit 719c731df3)
(cherry picked from commit 7ad36a5523)
2024-11-30 15:11:09 +01:00
Randy Eckenrode
d93cc69734 Revert "stdenv: set NIX_DONT_SET_RPATH_FOR_TARGET on Darwin"
This reverts commit 10c87ee2c7.

(cherry picked from commit 1810b522d7)
(cherry picked from commit 46affc6300)
2024-11-30 15:11:09 +01:00
Randy Eckenrode
10c87ee2c7 stdenv: set NIX_DONT_SET_RPATH_FOR_TARGET on Darwin 2024-07-13 17:54:35 -04:00
Robert Hensing
de516f6f13 make-derivation.nix: Return mkDerivation as an attribute 2024-03-11 17:06:02 +01:00
Ryan Burns
c324705cc3 treewide: simplify exec format conditionals 2024-01-07 17:43:33 -08:00
Vladimír Čunát
2141d9879a Revert "stdenv: use improved strip.sh for aarch64-linux"
This reverts commit 39919b8f21.
The parent merge resolved this more properly.
2023-07-31 11:20:15 +02:00
Vladimír Čunát
39919b8f21 stdenv: use improved strip.sh for aarch64-linux
Adapted from PR #246164
TODO: clean up / use it everywhere on the next rebuild.
2023-07-30 21:18:30 +02:00
Artturin
630bb71ac5 stdenv: sort defaultNativeBuildInputs alphabetically 2022-12-13 01:12:20 +02:00
Artturin
b3717f6c14 stdenv: remove now unneeded linux conditional 2022-12-13 01:04:29 +02:00
Artturin
7866db71cc stdenv/generic: fix todo 2022-12-13 00:34:48 +02:00
Robert Hensing
51518a5fd3 stdenv.tests: Add succeedOnFailure 2022-11-14 19:03:35 +01:00
Artturi
111abd87ca Merge pull request #168590 from amjoseph-nixpkgs/stdenv-disallowedReferences
stdenv: use disallowedRequisites to check forbidden requisites
2022-07-18 02:51:23 +03:00
Artturin
33415135b0 config.contentAddressedByDefault: init option 2022-04-27 23:21:32 +03:00
Adam Joseph
9d60e3dd29 stdenv: use disallowedRequisites to check forbidden requisites 2022-04-13 23:13:33 -07:00
Naïm Favier
f2065d81ad stdenv/generic: introduce shellDryRun
Add `shellDryRun` to the generic stdenv and substitute it for uses of
`${stdenv.shell} -n`. The point of this layer of abstraction is to add
the flag `-O extglob`, which resolves #126344 in a more direct way.
2021-12-27 20:30:01 -05:00
Vladimir Serov
523c701c0b stdenv: move overriden stdenv in closure
Before that, base stdenv passed non-makeOverridable version of itself
inside. This cause it to be lost on package-name.stdenv.
2021-11-27 01:23:32 +03:00
John Ericson
f110a182a6 stdenv: Fix overriding + overrideAttrs
The old stdenv adapters were subtly wrong in two ways:

 - `overrideAttrs` leaked the original, unoverridden `mkDerivation`.

 - `stdenv.override` would throw away any manually-set `mkDerivation`
   from a stdenv reverting to the original.

Now, `mkDerivation` is controlled (nearly directly) via an argument, and
always correctly closes over the final ("self") stdenv. This means the
adapters can work entirely via `.override` without any manual `stdenv //
...`, and both those issues are fixed.

Note hashes are changed, because stdenvs no previously overridden like
`stdenvNoCC` and `crossLibcStdenv` now are. I had to add some
`dontDisableStatic = true` accordingly. The flip side however is that
since the overrides compose, we no longer need to override anything but
the default `stdenv` from which all the others are created.
2021-08-18 17:22:50 +00:00
Ben Siraphob
d2c9f816e3 stdenv: remove lib 2021-06-03 19:50:15 +07:00
John Ericson
50a11f4f43 Merge pull request #120993 from regnat/easy-ca
Make the bootsrap respect the contentAddressedByDefault setting
2021-04-28 11:27:59 -04:00
regnat
14f66d60a7 Make the bootsrap respect the contentAddressedByDefault setting
Patch every `derivation` call in the bootsrap process to add it a
conditional `__contentAddressed` parameter.

That way, passing `contentAddressedByDefault` means that the entire
build closure of a system can be content addressed
2021-04-28 10:25:49 +02:00
github-actions[bot]
6ef7c23763 Merge master into staging-next 2021-04-19 18:11:51 +00:00
Alyssa Ross
730a9a04fa stdenv.isBSD: reinit
This was removed in e29b0da9c7, because
it was felt it was ambiguous whether isBSD should remove Darwin.

I think it should be reintroduced.  Packages sometimes have their own
concepts of "is BSD" e.g. Lua, and these almost never include Darwin,
so let's keep Darwin excluded.

Without a way to say "is this BSD", one has to list all flavours of
BSD seperately, even though fundamentally they're still extremely
similar.  I don't want to have to write the following!

    stdenv.isFreeBSD || stdenv.isNetBSD || stdenv.isOpenBSD || stdenv.isDragonFlyBSD

Additionally, we've had stdenv.hostPlatform.isBSD this whole time, and
it hasn't hurt anything.
2021-04-18 20:12:09 +00:00
Andrew Childs
44f09ccabf darwin: move deployment target and sdk version to platform config 2021-03-26 15:10:22 +09:00
Ben Siraphob
4da3c5ab1e stdenv/generic: recommend lib instead of pkgs.lib in place of stdenv.lib 2021-02-11 11:34:06 +07:00
Cole Helbling
c7942b0f8b stdenv/generic: allowAliases should default to true if unset
Since the deprecation is fairly recent, we should warn by default.

Also fix the wording of the comment: stdenv.lib will be removed for the 21.11
release, not just deprecated (as it already is deprecated).
2021-02-06 21:30:34 -08:00
Cole Helbling
afbeed62bb stdenv/generic: allowAliases should default to false if unset
Mostly because config.allowAliases doesn't exist unless it's set.
2021-02-06 19:44:30 -08:00
Edmund Wu
5b278c2f48 stdenv/generic: allowAlises -> allowAliases 2021-02-06 22:15:00 -05:00
Ben Siraphob
66e92385b9 stdenv/generic: throw when using stdenv.lib and disallowing aliases 2021-01-31 18:40:19 +07:00
Ben Siraphob
227693ed69 Update pkgs/stdenv/generic/default.nix
Co-authored-by: John Ericson <git@JohnEricson.me>
2021-01-31 03:03:11 +00:00
Ben Siraphob
32e8cec5d9 stdenv: warn about use of inherited lib 2021-01-30 18:42:48 +07:00
Andreas Rammhold
83f0bccc89 stdenv: add -frandom-seed to NIX_CFLAGS_COMPILE for reproducibility
This adds -frandom-seed to each compiler invocation in stdenv. The
object here is to make the compierl invocations produce the same output
every time they are called (for the same derivation). When the
-frandom-seed option is not set the compiler will use a combination of
random numbers (in GCC's case from /dev/urandom) and the durrent time to
produce a "random" input per file. This can (among other things) lead to
different ordering of symbols in the produced object files.

For reason of reproducibility we prefer having the same derivation
produce the exact same outputs. This is not a silver bullet but one way
to tame the compiler.
2020-11-01 19:40:12 +01:00