- Pass --with-multilib-list=m4,m4-nofpu for SH4 so the kernel can use
-m4-nofpu. Move libraries out of !m4/ multilib subdirectory in
postInstall before moveToOutput.
- Generate sysroot-suffix.h for SH4 in the standalone libgcc builder.
- Add linux-kernel.target = "vmlinux" and installTarget for SH4.
All changes scoped to isSh4 to avoid rebuilds on other platforms.
Add sh4 CPU type (32-bit, little-endian, family "sh"), isSh4 predicate,
"sh4-linux" system double, cross-compilation example (sh4-unknown-linux-gnu),
linuxArch mapping to "sh", and test entry.
`emptyValue` for `types.submodule` was `{ value = { }; }`, i.e. none
of the type-declared options or their defaults.
Previously submodules without defs would simply fail for lack of a default,
but since PR #500104 repurposed `emptyValue` as the fallback when no
definitions exist, submodule options without an explicit `default = { }`
(new additions) silently lost their sub-option defaults
(e.g. `requiredFeatures.devnet` in the nixos-test-driver, #511413).
Main change: `emptyValue`: `{ }` -> `{ value = base.config; }`
Additionally, skip `emptyValue`-based default rendering in docs for
types with submodules, because their sub-options are already documented
individually, and forcing evaluation here can break on modules with
invalid or incomplete definitions.
- When `evalModules` is called without deprecated `args`/`check` parameters (the common case), avoid `modules ++ []` which copies the entire module list for no reason.
- `collectModules` was calling `collectStructuredModules` twice with identical arguments — once for `filterModules` and once for `toGraph`. Share the result via a `let` binding.
- Replace `zipAttrsWith (n: v: v)` with `zipAttrs`
- Replace `concatMap` with `filter`+`map` in `filterOverrides'`
NixOS minimal eval improvement: -5.0% list_concats, -1.2%
nrFunctionCalls, -0.7% nrThunks, -1.0% envs, -1.5% list_bytes.
Add arc CPU type (32-bit, little-endian, family "arc"), isArc
predicate, arc-linux double, arc cross example with
arc-unknown-linux-gnu triple, and release-cross job.
ARC has glibc support and uses the "arc" Linux kernel arch, which
matches the CPU name so no explicit linuxArch mapping is needed.
Replace `(optional (opt ? default) { ... }) ++ defs` with a direct
if/then/else. When the option has no default, this skips both the
list allocation and the ++ concat entirely. Most options do have
defaults, but even then we avoid the `optional` function call overhead
(closure + env allocation).
On NixOS minimal eval: -45K function calls (-0.93%), -3.7K list
concats (-1.93%).
The vast majority of option definitions reaching mergeDefinitions are
singletons whose value carries no _type wrapper (mkIf/mkMerge/
mkOverride/mkOrder). For those, the dischargeProperties ->
filterOverrides' -> sortProperties pipeline is a no-op yet still costs
~125k function calls and ~70k thunks on a minimal NixOS system eval.
Detect this case up front and reuse the input list as
defsFinal'.values, keeping the addErrorContext around the value probe
so error traces still point at the defining file. highestPrio is
defaultOverridePriority by construction.
A single-fold filterOverrides' was prototyped but allocates an attrset
per definition and regressed gc.totalBytes; with the fast path in
place that function is no longer hot enough to matter.
NIX_SHOW_STATS, minimal `nix-instantiate ./nixos -A system`:
nrFunctionCalls 5490285 -> 5365172 (-125113)
nrThunks 8182569 -> 8112150 (-70419)
gc.totalBytes 640.0M -> 635.2M (-4.8M)
Expand the doc comment with a structured description, type signature,
properly formatted parameter docs, and an example showing how to
implement modular services for a new containing system.
Use lib.filter and lib.attrNames instead of builtins.* directly,
consistent with the rest of the file's style.
Follow-up to #506588, incorporating review feedback from #507232.