mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-10-31 06:31:20 +00:00
2dfee94fe7
Note this doesn't actually provide musl support yet, just improves our "system" code to understand musl-based triples and non-glibc linux configurations.
49 lines
1.9 KiB
Nix
49 lines
1.9 KiB
Nix
{ lib }:
|
|
with import ./parse.nix { inherit lib; };
|
|
with lib.attrsets;
|
|
with lib.lists;
|
|
|
|
rec {
|
|
patterns = rec {
|
|
i686 = { cpu = cpuTypes.i686; };
|
|
x86_64 = { cpu = cpuTypes.x86_64; };
|
|
PowerPC = { cpu = cpuTypes.powerpc; };
|
|
x86 = { cpu = { family = "x86"; }; };
|
|
Arm = { cpu = { family = "arm"; }; };
|
|
Aarch64 = { cpu = { family = "aarch64"; }; };
|
|
Mips = { cpu = { family = "mips"; }; };
|
|
RiscV = { cpu = { family = "riscv"; }; };
|
|
Wasm = { cpu = { family = "wasm"; }; };
|
|
|
|
"32bit" = { cpu = { bits = 32; }; };
|
|
"64bit" = { cpu = { bits = 64; }; };
|
|
BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };
|
|
LittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; };
|
|
|
|
BSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; };
|
|
Unix = [ BSD Darwin Linux SunOS Hurd Cygwin ];
|
|
|
|
Darwin = { kernel = kernels.darwin; };
|
|
Linux = { kernel = kernels.linux; };
|
|
SunOS = { kernel = kernels.solaris; };
|
|
FreeBSD = { kernel = kernels.freebsd; };
|
|
Hurd = { kernel = kernels.hurd; };
|
|
NetBSD = { kernel = kernels.netbsd; };
|
|
OpenBSD = { kernel = kernels.openbsd; };
|
|
Windows = { kernel = kernels.windows; };
|
|
Cygwin = { kernel = kernels.windows; abi = abis.cygnus; };
|
|
MinGW = { kernel = kernels.windows; abi = abis.gnu; };
|
|
|
|
Musl = with abis; map (a: { abi = a; }) [ musl musleabi musleabihf ];
|
|
Glibc = with abis; map (a: { abi = a; }) [ gnu gnueabi gnueabihf ];
|
|
};
|
|
|
|
matchAnyAttrs = patterns:
|
|
if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns
|
|
else matchAttrs patterns;
|
|
|
|
predicates = mapAttrs'
|
|
(name: value: nameValuePair ("is" + name) (matchAnyAttrs value))
|
|
patterns;
|
|
}
|