5235 Commits
Author SHA1 Message Date
Eman Resu a709ca8240 lib.strings.splitString: compute escaped separator early
Thanks to moving the existing let variable out, this should have
identical performance for non-memoised calls, and improved performance
when caching the separator.
2026-06-24 17:16:56 -04:00
nixpkgs-ci[bot]andGitHub 546a6c9639 Merge staging-next into staging 2026-06-23 18:43:49 +00:00
Silvan MosbergerandGitHub dee7389683 lib.cli: performance refactors (#534026) 2026-06-23 13:54:55 +00:00
Eman Resu f3e6fa555f lib.attrsets.concatMapAttrs: add test for handling duplicates 2026-06-21 18:04:34 -04:00
Eman Resu 1c53d25f58 lib.attrsets.concatMapAttrs: rewrite for efficiency 2026-06-21 18:01:06 -04:00
Eman Resu 646409453c lib.cli.toGNUCommandLine: beta reduce mkList for free 2026-06-21 16:21:45 -04:00
Eman Resu a023145c70 lib.cli: use partially applied mkValueStringDefault 2026-06-21 16:16:02 -04:00
Eman Resu 1ffe9499a2 lib.cli.toGNUCommandLine: move variable definition to higher scope 2026-06-21 16:13:54 -04:00
Eman Resu 72785188e1 lib.cli: inherit functions to global scope 2026-06-21 16:13:36 -04:00
Eman Resu 101fd9ad15 lib.cli.toCommandLine: share let variables for a single optionFormat 2026-06-21 16:06:53 -04:00
Emily bd83232593 lib/systems/doubles: drop x86_64-darwin
This ensures that `lib.platforms.darwin` doesn’t include
`x86_64-darwin` and that the unsupported platform check will trigger
even once the bespoke deprecation error is removed. It doesn’t break
`lib.systems.elaborate "x86_64-darwin"`.
2026-06-21 19:37:17 +01:00
Emily 41341de669 lib/systems/examples: drop x86_64-darwin 2026-06-21 19:37:17 +01:00
Emily c6adddfbc2 lib/systems/flake-systems: drop x86_64-darwin 2026-06-21 19:22:33 +01:00
Eman Resu add81e270c lib.systems.doubles: only typecheck in CI 2026-06-20 17:05:35 -04:00
Eman Resu 0bc9fb54a4 lib.systems.parse: avoid toString if no version specified 2026-06-20 17:05:35 -04:00
Eman Resu 38816ea2a3 lib.systems.inspect: save memory when removing attributes 2026-06-20 17:05:35 -04:00
Eman Resu 6e37f410ad lib.systems.parse: avoid redefining component lists 2026-06-20 17:05:35 -04:00
Eman Resu 14da2748d2 lib.systems.parse: define variables for components 2026-06-20 17:05:34 -04:00
Eman Resu c344980c19 lib.systems.parse: avoid some function calls 2026-06-20 17:05:34 -04:00
Eman Resu 753e3defc2 lib.systems.parse: inherit verification functions 2026-06-20 17:05:34 -04:00
Eman Resu 792207ab34 lib.systems.parse: rewrite to use meta-types 2026-06-20 17:05:34 -04:00
Eman Resu bbad0fcf20 stdenv/meta-types: support non-strings in enums 2026-06-20 17:05:34 -04:00
Eman Resu 50cf7fe9dc stdenv/check-meta: move to within lib/
This is going to be used in lib.systems, which isn't allowed to import
from outside the lib folder. We don't actually expose this through lib,
though.
2026-06-20 17:05:33 -04:00
Eman Resu c5cb2f465c lib.systems: cache attrNames calls for each pattern 2026-06-20 17:05:30 -04:00
Eman Resu 88d7ba7fc7 lib.systems: only run isAttrs on one side when recursing 2026-06-20 17:05:16 -04:00
Eman Resu d65d6f570f lib.systems: define matchAttrs locally
Skipping the assertion.
2026-06-20 17:05:14 -04:00
Eman Resu e7a80a0510 lib.attrsets.matchAttrs: check attrset equality before recursing 2026-06-20 16:53:33 -04:00
Eman Resu bc4b353bff lib.attrsets.matchAttrs: only assert isAttrs once 2026-06-20 16:53:32 -04:00
Eman Resu 0cadcfb613 lib.systems: define let variables outside of function 2026-06-20 16:53:32 -04:00
d18g 495906d50a lib.types: types.attrTag declaration info
Closes #303082
2026-06-18 15:23:42 +03:00
Matt SturgeonandGitHub 437220a111 lib/systems: gate linux-kernel assertion behind oldestSupportedRelease (#532194) 2026-06-17 11:44:55 +00:00
Matt Sturgeon f5f59e0c4a lib/systems: gate linux-kernel assertion behind oldestSupportedRelease
A platform elaborated by another supported revision of Nixpkgs would
trip the assertion when it is re-elaborated.

Avoid this, by checking `oldestSupportedReleaseIsAtLeast 2511`, as 25.11
is the version that stopped adding `linux-kernel` to elaborated systems.
2026-06-16 06:43:14 +01:00
Sam Pointon 4a3079eda3 systems: set rust.platform.env as rustc does
rustc allows code to perform compile-time tests against target_env [0], 
which is a function of the target triple. There isn't provision in 
Nixpkgs for learning target_env, however. That doesn't affect rustc's 
evaluation of cfg guards in Rust code - rustc knows perfectly well what 
target_env is - but it _does_ affect the env vars passed to a build 
script set by buildRustCrate, which is presently hard-coded to gnu, and 
also affects any Nix code looking to branch on target_env.

Being able to access target_env is very relevant to, for example, WASI 
as (using Rust terminology) wasm32-wasip1 and wasm32-wasip2 differ only 
by target_env, with identical target_arch and target_os values. Properly 
reflecting target_env may also fix some random musl issues if you're a 
bit lucky.

This commit adds a new attr, rust.platform.env, which reflects the 
target_env that rustc will set for the target, and wires it up in 
buildRustCrate. In isolation, this change mostly only affects build 
scripts checking target_env, but crate2nix will greatly benefit from 
being able to accurately resolve the dep graph (which can also vary 
depending on target_env).

The target triple -> target_env function resists Kolmogorov compression: 
it's irregular and, though there are some patterns, there are lots of 
special cases. So, I have done the stupidest possible thing and scraped 
out all of the targets with non-empty target_env values and dumped that 
into an attrset. This attrset will progressively get out of date as 
rustc adds new platforms, but updating it should be simple enough - I've 
included the generation script as a comment.

There are some other configuration options not being reflected in Nix. I 
have left those alone, but, in the future, maybe this can be extended to 
just dumping all of them into an attrset and then reflecting them in 
rust.platform. It might even make sense to convert the existing code 
producing rust.platform to just looking up from an attrset and to 'do 
what rustc does'.

I would have liked to have added a test targetting a platform with a 
non-empty non-GNU target_env, but all of the yaks were quite hairy.

Fixes https://github.com/NixOS/nixpkgs/issues/436832

[0]: https://doc.rust-lang.org/reference/conditional-compilation.html#r-cfg.target_env
2026-06-15 16:21:13 +01:00
Johannes KirschbauerandGitHub 6c0202028d lib.attrsets.mergeAttrsList: small arithmetic performance improvements (#528677) 2026-06-11 15:01:53 +00:00
Johannes Kirschbauer 0cb9aa055c lib/types: remove functor.wrapped after deprecation phase of 2 full releases 2026-06-10 21:24:53 +02:00
Eman Resu 2d99119aa0 lib.attrsets.mergeAttrsList: check equality instead of comparing 2026-06-10 12:22:39 -04:00
Emilyandzowoq 31d1d80b3f lib/systems: move kernel configuration out of the platform structure
Currently, you need to override `stdenv.hostPlatform` to request a
compressed kernel on AArch64, and the kernel configuration is split
between the central structured configuration and string snippets in
platform definitions. This has consequently made the latter bitrot
terribly. Since the platform‐specific logic is now very limited after
cleaning up the detritus, we can move it into the kernel derivation
and expose the relevant configuration there for anyone who wants to
customize it further or needs to read it out.

Co-authored-by: zowoq <59103226+zowoq@users.noreply.github.com>
2026-06-10 11:17:38 +10:00
zowoqandEmily 9497b712f6 linux/common-config: move USB_XHCI_TEGRA from lib/systems aarch64-multiplatform
Co-authored-by: Emily <vcs@emily.moe>
2026-06-08 18:05:35 +10:00
Eman Resu dd16d43a35 lib.attrsets.mergeAttrsList: use simpler midpoint function 2026-06-06 02:42:26 -04:00
Robert Hensing 235013cf37 treewide: drop unnecessary toString calls
Scope:
- Combination of
  - Textual matches of "baseNameOf (toString"
  - Redundant toString calls I've found with my latest
    "lazy paths" nix branch as they force lazy fetches into
    the store. More info and new PR soon.
- Only cases I believe are worthwhile or easily determined

I've determined the validity by
- testing llvmPackages instantiation
- figuring out which types can pass into any particular
  toString call - "human fuzzy type checker"

Behavior considerations by type:

- `path`: converted back to a string *without* context
  `baseNameOf` does not copy things to the store on its own,
  equivalent to its behavior for string inputs
- `null`: converted to `""` -> may be valid input!
  ok if "" would not have been acceptable anyway
- `string` itself: passed through identically -> trivial
- `attrset` with `outPath`: same coercion as built into
  the `baseNameOf` function -> trivial
- other atomic types: generally not sensible inputs to
  `baseNameOf` -> fuzzy but true
2026-06-04 13:11:56 +02:00
Emilyandzowoq 0c19eb3e55 lib/systems: unify ARMv5 platforms with stock kernel configuration
The `sheevaplug` kernel configuration was added a very long time
ago and has not been adjusted for years. `pogoplug4` was identical
to `sheevaplug` except for an even more stripped‐down kernel
configuration, no device tree support, and a different load address
for the uImage.

These days, the stock kernel configuration builds and there has been
an upstream device tree for the Pogoplug Series 4 for years; unify
`sheevaplug` and `pogoplug4` into an `armv5tel-multiplatform` that
uses the standard configuration.

ARMv5 was also the only platform that defaulted to uImage, the [legacy
U‐Boot image format] that is deprecated upstream. Our bootloader
machinery in NixOS does not handle these images in any special way
and even the original ARMv6 Raspberry Pi platform defaults to the
standard zImage. We switch `armv5tel-multiplatform` to zImage to match.

[legacy U‐Boot image format]: https://docs.u-boot.org/en/latest/usage/cmd/bootm.html#legacy-boot

It is of course natural to worry about backwards compatibility
here: this switches to a different kernel image format and drops
support for root on NFS along with random oddities like KGDB and
LatencyTOP. Renaming the platform is intended to help mitigate
this risk.

The reality, however, is that it is currently very
difficult to build a configuration for ARMv5. I found
<https://github.com/thefloweringash/sheevaplug-nix> online as
an example configuration from many years ago; it already set
`autoModules`, and builds U‐Boot using `CONFIG_DISTRO_DEFAULTS`,
which should work out of the box without requiring the legacy U‐Boot
image format.

Even then, however, I confirmed with the author that it hasn’t
been used in years, and I could barely get it to build with
a modern Nixpkgs: OpenSSH is broken, Nix is broken, multiple
default `environment.systemPackages` in the SD image profile
are broken, `boot.initrd.includeDefaultModules` is broken, and
`hardware.enableAllHardware` is broken.

I conclude that if anyone is actively building systems on ARMv5, they
have a forked Nixpkgs or a very custom setup. Given our general move
to standard boot chains and no platform‐specific hacks, and the
decaying state of our unofficial support for 32‐bit ARM, I think
it is not worth maintaining support for the legacy image format for
this one ancient platform.

If anyone is running a heavily stripped‐down NixOS configuration on
mission‐critical SheevaPlugs using a custom Nix‐free deployment
setup relying on the legacy U‐Boot image format and somehow none
of these kernel changes manage to loudly break their build, hopefully
they’ll at least notice the release notes entry! Otherwise there’s
always JTAG…
2026-06-01 11:12:17 +10:00
Emilyandzowoq af6485561c lib/systems: remove unused platforms
These were not used by the selection logic or
`lib/systems/examples.nix`, so any consumer would have to be including
them explicitly. Since we’re moving away from setting Linux kernel
configuration in the platform structure, breaking these explictily
won’t reduce the convenience and will help signal to any such expert
users that they need to move their kernel configuration elsewhere.
2026-06-01 11:12:17 +10:00
Emilyandzowoq 9c5ca61078 lib/systems: remove broken kernel configurations
None of these successfully build a kernel, and as we’re moving
away from putting kernel configuration in the platform structure and
don’t package the vendor kernels that all but `fuloong2f_n32` expect,
there’s no point to keeping these kernel configurations in Nixpkgs.
2026-06-01 11:12:17 +10:00
Emilyandzowoq d408bc4f02 lib/systems: remove obsolete KS8851_MLL workaround
This was fixed by 51bb08dd04a05035a64504faa47651d36b0f3125 upstream,
which is in all our supported kernels ≥ 5.12.
2026-06-01 11:12:17 +10:00
Emilyandzowoq c76c290c14 lib/systems: remove redundant kernel configuration
These are now already set upstream and should result in no change,
even for the Raspberry Pi vendor kernels.
2026-06-01 11:12:17 +10:00
Emilyandzowoq 53f91beef8 lib/systems: remove unused linux-kernel.Major field 2026-06-01 11:12:17 +10:00
Emilyandzowoq b59952e523 lib/systems: don’t specify multi_v7_defconfig explicitly
This has been the default for `defconfig` upstream since
32872c04ffd5a855c43802c5aa76c711eb021948, which is in all our
supported kernels.
2026-06-01 11:12:17 +10:00
Emilyandzowoq 1c935b9fd9 lib/systems: drop gnu64_simplekernel
This was unused apart from a commented‐out test, and we’re moving
away from specifying kernel configuration in the platform structure.
2026-05-30 14:12:51 +10:00
YtandGitHub a26e677695 python3Packages.emmiai-noether: init at 2026.4.0 (#525203) 2026-05-28 16:28:27 +00:00
Philip TaronandGitHub 19bd880f94 various: remove lib.warnIf from most critical functions (#524541) 2026-05-28 15:50:31 +00:00