Eman Resu
c546655fb0
check-meta: only take hostPlatform for functions requiring it
...
By doing this, we can cache the rest of the file, including the import
of problems.nix. This allows genCheckProblems to be cached on every
bootstrapping stage, and not re-called each time.
2026-05-29 16:51:26 -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
19bd880f94
various: remove lib.warnIf from most critical functions ( #524541 )
2026-05-28 15:50:31 +00:00
Eman Resu
7146b6678f
stdenv.mkDerivation: remove warnIf usage
...
warnIf sends our warning message through a function call, even if the
warning condition doesn't trigger. This requires a lot of thunk
allocation that can be easily avoided.
2026-05-28 00:19:23 -04:00
Philip Taron
e03d0a783d
various: reduce // merges, optimize ++ chains across hot paths ( #506793 )
2026-05-27 22:06:37 +00:00
adisbladis
3fbd42c407
stdenv.mkDerivation: Optimise hardening flag handling ( #517906 )
2026-05-21 03:07:31 +00:00
adisbladis
2be5bd483e
stdenv.mkDerivation: inline call to lib.toExtension ( #522125 )
2026-05-21 02:44:04 +00:00
Eman Resu
abae302132
stdenv.mkDerivation: move config lookups to global scope
2026-05-19 22:38:33 -04:00
Eman Resu
a351d833a2
stdenv.mkDerivation: move pos thunk inside another thunk
2026-05-19 21:16:57 -04:00
Eman Resu
a53a185737
stdenv.mkDerivation: inline call to toExtension
2026-05-19 21:14:17 -04:00
Aliaksandr
d6d58a85e1
make-derivation: remove no longer valid comment
...
The comment claimed configureFlags is "sometimes a string, sometimes
null, and sometimes a list" — the normalization it referenced was
removed long ago; configureFlags is always a list now.
2026-05-18 03:54:18 +03:00
Eman Resu
04078604e8
stdenv.mkDerivation: warn on nested lists
2026-05-16 22:12:08 -04:00
adisbladis
8e46c489d0
stdenv.mkDerivation: Optimise hardening flag handling
2026-05-10 16:16:46 +12:00
Eman Resu
1aea84e9f7
stdenv.mkDerivation: inherit all builtins
2026-05-09 20:37:46 -04:00
Eman Resu
13fb2f08dc
stdenv.mkDerivation: inherit all lib variables
2026-05-09 20:37:33 -04:00
Eman Resu
789a15ef68
stdenv.mkDerivation: move attrs removed for derivationArg to global scope
2026-05-09 20:37:22 -04:00
Eman Resu
9f278a55db
stdenv.mkDerivation: store default builder args in global scope
2026-05-09 20:37:14 -04:00
Eman Resu
8de09cd1f8
stdenv.mkDerivation: move reference checking attrs to global scope
2026-05-09 20:37:11 -04:00
Eman Resu
57c99d5722
stdenv.mkDerivation: move list of attribute names out to global scope
2026-05-09 20:27:58 -04:00
Eman Resu
dfa34d9376
stdenv.mkDerivation: move attrNames out of happy path
2026-05-09 20:26:45 -04:00
Eman Resu
2113c381ea
stdenv.mkDerivation: move errors variable out of happy path
2026-05-09 20:26:44 -04:00
Eman Resu
95a031c363
stdenv.mkDerivation: remove assertMsg usage
...
Saves function calls on the happy path.
2026-05-09 20:26:42 -04:00
Eman Resu
9c1453602e
stdenv.mkDerivation: only create enabledHardeningOptions variable if necessary
2026-05-09 20:26:08 -04:00
Eman Resu
32dc7f6f02
stdenv.mkDerivation: inline hardeningDisable'
...
We can safely check `elem "all" hardeningDisable'` on the original list,
because calling `unique` and `concretizeFlagImplications` will never
change whether the list contains "all".
2026-05-09 20:26:08 -04:00
Eman Resu
faf7bd1d38
stdenv.mkDerivation: move concretizeFlagImplications to global scope
2026-05-09 20:26:08 -04:00
Eman Resu
152d862bb0
stdenv.mkDerivation: cache output checks to avoid reallocating
2026-05-09 19:25:03 -04:00
Eman Resu
fc43f076bb
stdenv.mkDerivation: avoid listToAttrs if outputChecks will end up empty
2026-05-09 19:14:47 -04:00
Eman Resu
26b51ec16d
stdenv.mkDerivation: avoid concat if separateDebugInfo' is false
2026-05-09 19:11:05 -04:00
Eman Resu
fde4f1c5a0
stdenv.mkDerivation: check meta.mainProgram from original meta
...
We define a meta variable in the same let block as the result of
the `commonMeta` call. Avoiding evaluating the result of that call
until we need to is preferable.
2026-05-09 18:25:32 -04:00
Eman Resu
ac796e9827
stdenv.mkDerivation: use or statement for default hardening flags
...
As suggested in PR review:
"It seems like when `!stdenvHasCC`, `stdenv.cc` is `null`. So this could
probably just be `defaultHardeningFlags =
stdenv.cc.defaultHardeningFlags or knownHardeningFlags;`?"
2026-05-09 16:40:36 -04:00
Eman Resu
ce35986f7f
stdenv/mkDerivation: only run zipAttrsWith if we have to
...
If attrs.outputChecks.${name} is undefined, we'd be performing an
unnecessary no-op.
2026-05-09 15:50:15 -04:00
Eman Resu
ec66d5fc09
stdenv.mkDerivation: only run fold if an invalid type or list is passed
2026-05-09 15:50:15 -04:00
Eman Resu
7b8b8413ea
stdenv.mkDerivation: avoid checking dependency list for empty lists
2026-05-09 15:50:14 -04:00
Eman Resu
0ae0cab0b8
stdenv.mkDerivation: fallback to knownHardeningFlags directly with stdenvNoCC
2026-05-02 17:27:49 -04:00
Eman Resu
0d2799e68b
stdenv.mkDerivation: check that build inputs are empty individually
...
Allows short-circuiting and less concatenation. Thanks to the last
commit, this is now only meaningful if `hostPlatform != buildPlatform`.
2026-05-02 17:27:49 -04:00
Eman Resu
9e49230e6d
stdenv.mkDerivation: check if host suffix is necessary
...
Rather than precomputing what the stdenv host suffix should be, we check
the condition first. This is even better than turning the concats into
multiple comparisons (although I'm going to do that as well), since if
hostPlatform == buildPlatform, we never have to evaluate any further.
2026-05-02 17:27:49 -04:00
Eman Resu
efa31b9d8b
stdenv.mkDerivation: invert conditions, move stdenv check upwards
2026-05-02 17:27:49 -04:00
Eman Resu
79aec2d4bf
stdenv.mkDerivation: avoid // merge if meta.mainProgram not set
2026-05-02 17:27:48 -04:00
adisbladis
b5bb13f9d5
stdenv: Don't copy dependency input lists when type checking
2026-04-29 21:24:35 +12:00
Eman Resu
9c56dc6670
stdenv.mkDerivation: fully expand out dependency variables
2026-04-26 18:01:56 -04:00
Eman Resu
5e34717502
stdenv.mkDerivation: inline function calls
2026-04-26 16:32:00 -04:00
Eman Resu
407f9757db
stdenv.mkDerivation: remove pie hardening flag warning
2026-04-26 16:31:59 -04:00
Eman Resu
9500a7bff7
stdenv.mkDerivation: remove duplicate assertions
2026-04-26 16:31:52 -04:00
Eman Resu
6926e99cff
stdenv.mkDerivation: define dependencies and propagatedDependencies as separate variables
2026-04-26 13:38:31 -04:00
Eman Resu
db60650a72
stdenv.mkDerivation: use head foo instead of elemAt foo 0
2026-04-26 13:26:48 -04:00
Eman Resu
52d158340e
stdenv.mkDerivation: compare to [] instead of using builtins.length
2026-04-26 13:26:45 -04:00
Eman Resu
34a0d84478
stdenv.mkDerivation: inline variable
2026-04-26 12:45:13 -04:00
Eman Resu
e70789fb5a
stdenv.mkDerivation: inline variable
2026-04-26 12:45:13 -04:00
Eman Resu
d38a01c259
stdenv.mkDerivation: inline functions already in scope
2026-04-26 12:43:58 -04:00
Eman Resu
a07d262b88
stdenv.mkDerivation: inline variable
2026-04-26 12:00:15 -04:00