618 Commits

Author SHA1 Message Date
Emily
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
Emily
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
Emily
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
Emily
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
Emily
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
Emily
53f91beef8 lib/systems: remove unused linux-kernel.Major field 2026-06-01 11:12:17 +10:00
Emily
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
Emily
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
Emily
ba777b3b20 lib.systems.equals: fix euqality on re-elaborated platform (#521043) 2026-05-16 18:39:00 +00:00
Mix
cadca751c4 lib.systems.equals: fix euqality on re-elaborated platform 2026-05-17 02:14:48 +08:00
adisbladis
5a4597cc83 lib.systems: foldl -> foldl' 2026-05-16 15:51:29 +12:00
Emily
036199b38a lib.systems.equals: only filter functions once (#513844) 2026-05-13 00:56:58 +00:00
eveeifyeve
a8f0a99212 nim: deprecate and move os and cpu to stdenv.targetPlatform.nim
This change makes it more accesssable to using nim cpu and os without
referencing nim.
2026-05-06 22:29:23 +10:00
Alyssa Ross
a58377983f lib.systems: various small performance improvements (#514493) 2026-05-04 08:15:54 +00:00
Eman Resu
acd5585a3b lib.systems.parse: check if cpus are equal first
Rather than doing this last, we do it first. Saves a little time if
we're comparing to an identical platform
2026-05-03 16:49:37 -04:00
Eman Resu
833f05d099 lib.systems.elaborate: prevent unnecessary attrset merges 2026-05-03 08:04:34 -04:00
Eman Resu
a9c0a094f7 lib.systems.elaborate: avoid optionalAttrs merge 2026-05-03 08:04:34 -04:00
Eman Resu
7fcbff801d lib.systems.parse: only check condition once 2026-05-03 08:04:33 -04:00
Eman Resu
577b481774 lib.systems.parse: use builtins.head foo instead of elemAt foo 0 2026-05-03 08:04:28 -04:00
Rasheeq Azad
29101432aa lib.systems.architectures: add rocketlake 2026-05-02 18:47:17 -04:00
Eman Resu
0f0f29fcf1 lib/systems: store version of elaborated system without functions 2026-04-26 23:56:51 -04:00
Eman Resu
590d99ed5f lib/systems: remove old isCompatible 2026-04-26 22:14:48 -04:00
Ben Siraphob
0f420e96c4 gcc, libgcc: fix cross-compilation for SH4
- 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.
2026-04-20 13:02:20 -07:00
Ben Siraphob
0fcb031c25 lib/systems: add SH4 (SuperH) cross-compilation target
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.
2026-04-20 13:02:20 -07:00
Alyssa Ross
7251a763b7 lib/systems: fix incorrect CPU compatibility claims in isCompatible (#509796) 2026-04-19 09:44:23 +00:00
Ben Siraphob
6152e8cbfa lib/systems: add ARC (Synopsys DesignWare ARC) cross-compilation support
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.
2026-04-14 13:51:11 -07:00
Ben Siraphob
34109687c7 lib/systems: fix incorrect CPU compatibility claims in isCompatible
Fix several incorrect backward-compatibility claims in the isCompatible
relation that do not reflect actual hardware/spec capabilities.

- armv6m: Reverse direction. ARMv6-M (Cortex-M0) is Thumb-only and
  cannot run full ARMv6 ARM-state code; armv6m code runs on armv6l.
  https://developer.arm.com/documentation/ddi0432/latest/programmers-model/instruction-set-summary

- armv7m: ARMv7-M (Cortex-M3/M4) is Thumb-2 only, cannot run ARM-state
  armv7l code. armv7a/armv7r (which have ARM-state) can run armv7m code.
  https://developer.arm.com/documentation/ddi0403/d/Application-Level-Architecture/The-ARMv7-M-Instruction-Set/About-the-instruction-set

- armv8m: Remove armv8m->armv8a. ARMv8-M is Thumb-only M-profile with
  incompatible system registers and exception model.

- aarch64<->armv8a: Remove bidirectional equivalence. AArch32 cannot
  execute A64 instructions. Keep one-directional aarch64->armv8a only.
  https://developer.arm.com/documentation/dui0801/b/BABBDFIH

- armv8r: Remove armv8r->armv8a (and by extension armv8r->aarch64).
  ARMv8-R is a different profile with MPU (not MMU), a different
  exception model, and profile-specific instructions.

- riscv32->riscv64: Remove. RV64 has no standard RV32 compat mode;
  identical encodings behave differently at XLEN=32 vs XLEN=64.
  https://docs.riscv.org/reference/isa/unpriv/rv64.html

- wasm32->wasm64: Remove. Separate spec targets with different address
  types (i32 vs i64); a wasm64 runtime does not accept wasm32 modules.
  https://github.com/WebAssembly/spec/blob/wasm-3.0/proposals/memory64/Overview.md
2026-04-13 19:26:18 -07:00
zimbatm
03b9d66f3d lib.systems.equals: use lib imports instead of builtins
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.
2026-04-06 18:53:16 +02:00
zimbatm
878a387240 lib.systems.equals: optimize removeFunctions
Replace filterAttrs + lib.isFunction with removeAttrs + builtins.filter
+ builtins.isFunction. System attrs are never __functor-style attrsets,
so lib.isFunction's wrapper is unnecessary overhead. The double negation
(!pred ∘ !isFunction) also cancels out.

NIX_SHOW_STATS delta on hello.drvPath:

  nrFunctionCalls:  229,883 -> 154,411   (-32.8%)
  envs.number:      250,215 -> 174,743   (-30.2%)
  envs.bytes:         4.6M -> 3.4M       (-26.4%)
  nrAvoided:        291,314 -> 216,054   (-25.8%)
  gc.totalBytes:     49.7M -> 48.5M      (-2.4%)

Repro:

  NIX_SHOW_STATS=1 nix-instantiate --eval \
    -E '(import ./. {}).hello.drvPath' 2>stats.json >/dev/null
  jq . stats.json
2026-04-04 14:19:54 +02:00
Emily
c9fd2f4d87 lib/systems: remove redundant conditional 2026-03-29 09:07:03 +10:00
Amaan Qureshi
e0801cae76 lib/systems: fix qemuArch for aarch64_be
`qemuArch` returned "aarch64" for both LE and BE, causing binfmt to
register `qemu-aarch64` for `aarch64_be` binaries. QEMU ships separate
`qemu-aarch64` and `qemu-aarch64_be` binaries, so the wrong interpreter
was used, failing with "Invalid ELF image for this architecture".

Since QEMU distinguishes endianness in the binary name, this adds the
"_be" suffix via `isBigEndian`, which is similar to the approach MIPS 
uses a few lines below.
2026-03-16 23:49:50 -04:00
Alyssa Ross
bd0c7ad05a lib.systems: rust: Make rustcTargetSpec the primary entrypoint (#446668) 2026-03-07 08:22:44 +00:00
Tobias Mayer
4c05f197e6 lib.systems: s/makeMuslParsedPlatform/mkMuslSystem/ 2026-03-06 23:38:09 +01:00
Tristan Ross
3faec18180 lib.systems: expose makeMuslParsedPlatform (#490520) 2026-03-06 16:37:06 +00:00
İlkecan Bozdoğan
6acae46c84 lib: don't inherit unused functions 2026-03-04 00:10:00 +03:00
İlkecan Bozdoğan
e394a579b0 lib: update type signatures
- concrete types start with uppercase: Int, String, Bool, Derivation,
  etc.
- type variables start with lowercase: a, b, etc.
- list:
  - use `[x]` for homogeneous lists instead of `List x` or `[ x ]`
  - use `List` for heterogeneous lists (not that common in `lib`)
- attr:
  - use `AttrSet` for a generic attribute set type
  - use `{ key1 :: Type1; key2 :: Type2; ... }` for adding signatures
    for known attribute names and types
  - use `{ key1 = value1; key2 = value2; ... }` for adding attributes
    with known literals
  - end with an ellipsis (`...`) if the set can contain unknown
    attributes
  - use `{ [String] :: x }` if all the attributes has the same type `x`
- prefer `Any` over `a` if the latter is not reused
2026-03-04 00:10:00 +03:00
John Ericson
704e1a5c16 lib.systems: add uefi support (#477645) 2026-03-02 05:32:37 +00:00
dramforever
60ac986e49 lib.systems: rust: Make rustcTargetSpec the primary entrypoint
Make rustcTargetSpec the primary entrypoint for setting a custom target,
and wire up all the other stuff so they are hopefully as working and as
broken as before.

In particular, to specify a custom target, the user now just specifies
rust.rustcTargetSpec. rust.platform and rust.cargoShortTarget are
populated from rust.rustcTargetSpec now. In addition, rust.rustcTarget
defaults to rust.cargoShortTarget. (rust.rustcTarget and
rust.cargoShortTarget really should always be the same, but I think we
can deal with that later).

This allows the user to more easily control the basename of
rust.rustcTargetSpec by passing e.g.
"${./rust}/mips64el_mips3-unknown-linux-gnuabi64.json", which allows
cc-rs and in turn std to work.
2026-02-27 13:34:31 +08:00
dramforever
550a1b8eb5 lib.systems: Refactor rust.platform generation
In preparation for a future commit, refactor rust.platform somewhat.

No functional changes intended. Most of the diff here is whitespace
changes.
2026-02-25 11:18:23 +08: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
Alexandre Esteves
4255fb08c9 lib.systems: fix path to wine executable 2026-02-10 20:16:44 +00:00
Alyssa Ross
95c8d1ec1e lib/systems/platforms: Add ppc64; linux: Add 64-bit POWER settings, strip vmlinux kernels (#447752) 2026-02-02 12:10:28 +00:00
Theo Paris
9f605ca95e lib.systems: add uefi support
Signed-off-by: Theo Paris <theo@theoparis.com>
Change-Id: I51ce15449fc83f0ff39277d7cde7b34a6a6a6964

lib.systems: remove i686-uefi
2026-01-25 21:59:21 -08:00
Alexandre Esteves
03a5813e98 lib/systems: Add nodejs as emulator for pkgsCross.ghcjs 2026-01-25 23:16:19 +00:00
OPNA2608
2a6945e553 lib/systems/platforms: Drop powernv extraConfig
Settings are covered by ppc64 changes in common-config.
2026-01-22 15:41:33 +01:00
OPNA2608
3e6bae2fa4 lib/systems/platforms: Add ppc64 2026-01-22 15:40:36 +01:00
nixpkgs-ci[bot]
db8a4e9f0b Merge master into staging-next 2026-01-15 18:09:05 +00:00
John Ericson
3ea6894af1 Add clang64 toolchain to pkgsCross (#450796) 2026-01-15 14:49:16 +00:00
nixpkgs-ci[bot]
95416609f8 Merge master into staging-next 2026-01-13 18:07:18 +00:00
aleksana
38be8c6c9b lib.systems: correct and simplify canExecute condition regarding march 2026-01-13 18:44:51 +08:00