Commit Graph

132 Commits

Author SHA1 Message Date
·𐑑𐑴𐑕𐑑𐑩𐑤
5241238f68 lib/systems: add picolibc 2026-07-28 22:33:36 -07:00
Sam Pointon
629b4ee093 systems: rename extant wasi targets to wasip1
Wasi P2 is different enough to Wasi P1 to warrant being treated entirely 
separately, rather than as two minor variants of the same thing. P3 will 
likewise want to be a different target.

I've left aliases in place; maybe eventually, those can be deprecated 
and removed. I've tested this, but it's possible there might be breakage 
somewhere (e.g., the canonical doubles for P1 have changed, though I 
can't imagine why anyone would rely on that).

Fixes https://github.com/NixOS/nixpkgs/issues/435954
2026-07-28 19:50:03 +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
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
0cadcfb613 lib.systems: define let variables outside of function 2026-06-20 16:53:32 -04: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
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
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
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
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
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
Alessandro Di Federico
90b59828be uclibc-ng: detect CONFIG_ARM_EABI from platform
This commit introduces a `isEabi` predicate for platforms and employs it
to detect whether to configure uclibc with CONFIG_ARM_EABI or not.
2025-12-30 19:05:44 +01:00
OPNA2608
37492033eb lib.systems.parse: Default glibc ppc64 to ELFv1 ABI 2025-10-11 21:00:33 +02:00
David McFarland
39fd8e4adf cygwin: init as a target toolchain
The old cygwin support used -pc-windows-cygnus as the config.  This is
supported by LLVM, but not by GNU. This will change it to -pc-cygwin,
which is more generally supported.

Because the kernel is now 'cygwin' rather than 'windows', isWindows will
return false. There are lots of different reasons isWindows is used in
nixpkgs, but in my experience they often have to do with posix
compatibility and don't apply to cygwin.

Co-authored-by: Brian McKenna <brian@brianmckenna.org>
2025-09-27 13:29:44 -03:00
zowoq
0931f4e861 Revert "pkgs/top-level/stage.nix: add pkgsLLVMLibc"
This reverts commit 41b14024d2.
2025-04-24 14:04:25 +10:00
Emily
61582c7043 lib/systems: use Darwin architecture names for config and uname
`aarch64-apple-darwin` no longer works with LLVM 20.
2025-04-02 21:22:47 +01:00
Silvan Mosberger
374e6bcc40 treewide: Format all Nix files
Format all Nix files using the officially approved formatter,
making the CI check introduced in the previous commit succeed:

  nix-build ci -A fmt.check

This is the next step of the of the [implementation](https://github.com/NixOS/nixfmt/issues/153)
of the accepted [RFC 166](https://github.com/NixOS/rfcs/pull/166).

This commit will lead to merge conflicts for a number of PRs,
up to an estimated ~1100 (~33%) among the PRs with activity in the past 2
months, but that should be lower than what it would be without the previous
[partial treewide format](https://github.com/NixOS/nixpkgs/pull/322537).

Merge conflicts caused by this commit can now automatically be resolved while rebasing using the
[auto-rebase script](8616af08d9/maintainers/scripts/auto-rebase).

If you run into any problems regarding any of this, please reach out to the
[formatting team](https://nixos.org/community/teams/formatting/) by
pinging @NixOS/nix-formatting.
2025-04-01 20:10:43 +02:00
Tristan Ross
41b14024d2 pkgs/top-level/stage.nix: add pkgsLLVMLibc 2025-01-10 20:54:19 -08:00
Jean-François Roche
fc31945f1e lib/systems/parse.nix: mkSkeletonFromList: improve error message (#211213)
Include the system string in the error message to give a bit more context to
the user.

Co-authored-by: Wolfgang Walther <wolfgangwalther@users.noreply.github.com>
2024-12-12 18:30:47 +01:00
Ilan Joselevich
957116419d lib.systems.examples: add wasm32-unknown-none
This system was added to use the nixpkgs cross compilation logic when
compiling to wasm32-unknown-unknown in rust.
2024-06-24 19:27:13 +03:00
Ali Abrar
888dee445d openbsd: init at 7.5 2024-05-26 10:55:56 -04:00
John Ericson
266cdd7d37 treewide: freebsd13 -> freebsd
Co-authored-by: Alyssa Ross <hi@alyssa.is>
2024-04-30 18:20:23 -04:00
Philip Taron
79ce46fe49 Avoid top-level with ...; in lib/systems/parse.nix 2024-03-19 16:16:44 -07:00
Philip Taron
07d3270dbc lib/systems: inherit from lib.systems.inspect.predicates in lib/systems/parse.nix 2024-03-19 16:09:37 -07:00
Philip Taron
123a2f0fcc lib/systems: use lib.systems.parse and lib.systems.inspect.predicates instead of re-importing 2024-03-19 16:09:37 -07:00
Adam Joseph
20b62456f0 lib/systems/parse.nix: add, use removeAbiSuffix
gnu-config will ignore the portion of a triple matching the regex
`e?abi.*$` when determining the validity of a triple.  In other
words, `i386-linuxabichickenlips` is a valid triple.

This commit updates our parsing routines to match gnu-config.

I was recently surprised to discover that it is in fact possible to
shoehorn ABI flavors into nix doubles in a way which preserves their
property of being a (non-canonical) subset of the valid gnu-config
triples.  This commit is required in order to exploit that discovery
to add automatic detection of ILP32 platforms (64-bit void*, 32-bit
int, like the Apple Watch and MIPS n32) to Nix.
2023-10-22 17:05:05 -07:00
Adam Joseph
92939f4ce2 lib/systems/parse.nix: show respect where deserved
The eminent Donald E. Knuth should be recognized as having equal
standing with such entities as IBM, Apple, and the Personal
Computer.  We should acknowledge this by including him as a "vendor".

Also, `gnu-config` recognizes `mmix-knuth-*` triples (and in fact
requires `vendor="knuth"` when `cpu="mmix"`) -- so we sort of have
to.  But we should do it anyways.
2023-06-18 21:02:46 -07:00
Alyssa Ross
94d9a6ce17 lib.systems: remove mipsisa(32|64)r6 triples
These arc the same as the normal triples apart for a difference in
-march, so there's no need for them to be separate triples.
2023-06-01 10:42:27 +00:00
jackyliu16
edcad332d9 lib.platforms.loongarch64: init 2023-04-27 20:04:30 +03:00
sternenseemann
471b9cab41 haskell.compiler.ghcHEAD: 9.7.20221224 -> 9.7.20230217
- Christmas is over!

- Upstream has changed the name of the target triplet used for the JS
  backend from js-unknown-ghcjs to javascript-unknown-ghcjs, since Cabal
  calls the architecture "javascript":
  6636b67023

  Since the triplet is made up anyways, i.e. autoconf does not support
  it and Rust uses different triplets for its emscripten backends, we'll
  just change it as well.

- Upstream fixed the problem with ar(1) being invoked incorrectly by stage0:
  e987e345c8
2023-03-08 17:12:18 +01:00
Atemu
44e5b41871 lib/systems/parse: stop considering armv8a able to execute armv7l
In the past, most (if not all) armv8 CPUs could also execute armv7. However,
with the advent of Apple Silicon, aarch64 CPUs without any aarch32 capabilities
are now wide-spread among users.
2023-01-21 16:28:49 +01:00
Adam Joseph
06939ff3de add mipsisa{32,64}r6[el], closes 209952 2023-01-09 16:04:16 -08:00
Adam Joseph
36a566b78f lib/systems/parse.nix: mkSkeletonFromList: improve readability
The main purpose of this PR is to make the basis for
`mkSkeletonFromList`'s decision between `cpu-kernel-libcabi` vs
`cpu-vendor-os` clear, without changing its behavior.  The existing
code obscures this decision behind a sequence of prioritized matches
(i.e. `if-then`) which jump around between different coordinates.

Two side benefits of this PR:

1. It makes the root cause of #165836 obvious: we are missing a case
   for `cpu-vendor-libcabi`.  This is why nixpkgs stumbles over
   `*-none-*`.

2. It illuminates some very weird corner cases in the existing
   logic, like `*-${vendor}-ghcjs` overriding the `vendor` field,
   and `mingw32` being transformed into `windows` in some cases.

Co-authored-by: John Ericson <git@JohnEricson.me>
2022-11-13 23:08:57 -08:00
John Ericson
66aa02f190 lib/systems: Support FreeBSD
A tricky thing about FreeBSD is that there is no stable ABI across
versions. That means that putting in the version as part of the config
string is paramount.

We have a parsed represenation that separates name versus version to
accomplish this. We include FreeBSD versions 12 and 13 to demonstrate
how it works.
2022-11-04 16:49:28 -04:00
Minijackson
3fa4274ff6 lib/systems/parse: use ELFv2 by default for PPC64 BE 2022-08-28 21:46:44 +02:00
Minijackson
da2d9a2aca lib/systems: add elfv1 / elfv2 ABIs 2022-08-28 21:46:44 +02:00
Minijackson
4db467f7e9 lib/systems: add MicroBlaze architectures 2022-08-25 16:00:42 +02:00
sternenseemann
fe836f3564 lib/systems/parse: don't consider mode switching CPUs compatible
Since we (exclusively) use isCompatible to gauge whether platform a can
execute binaries built for platform b, mode switching CPUs are not to be
considered compatible for our purposes: Switching the mode of a CPU
usually requires a reset. At the very least we can't execute a mix of
executables for the two modes which would usually be the case in nixpkgs
where we may want to execute buildInputs for the hostPlatform in
addition to nativeBuildInputs for the buildPlatform.
2022-05-23 21:25:04 +02:00
yvt
bf139d83ec systems: support cross-compiling for Renesas RX microcontrollers (#173858) 2022-05-22 20:52:36 -04:00