2017-05-21 19:39:23 +02:00
|
|
|
with import ./parse.nix;
|
|
|
|
with import ../attrsets.nix;
|
2017-06-12 19:27:10 +02:00
|
|
|
with import ../lists.nix;
|
2017-05-21 19:39:23 +02:00
|
|
|
|
|
|
|
rec {
|
2017-06-12 19:27:10 +02:00
|
|
|
patterns = rec {
|
2017-05-21 19:39:23 +02:00
|
|
|
"32bit" = { cpu = { bits = 32; }; };
|
|
|
|
"64bit" = { cpu = { bits = 64; }; };
|
|
|
|
i686 = { cpu = cpuTypes.i686; };
|
|
|
|
x86_64 = { cpu = cpuTypes.x86_64; };
|
2017-07-09 21:12:32 +02:00
|
|
|
PowerPC = { cpu = cpuTypes.powerpc; };
|
2017-05-22 23:09:06 +02:00
|
|
|
x86 = { cpu = { family = "x86"; }; };
|
2017-05-21 19:39:23 +02:00
|
|
|
Arm = { cpu = { family = "arm"; }; };
|
|
|
|
Mips = { cpu = { family = "mips"; }; };
|
|
|
|
BigEndian = { cpu = { significantByte = significantBytes.bigEndian; }; };
|
|
|
|
LittleEndian = { cpu = { significantByte = significantBytes.littleEndian; }; };
|
|
|
|
|
|
|
|
BSD = { kernel = { families = { inherit (kernelFamilies) bsd; }; }; };
|
2017-07-03 14:31:25 +02:00
|
|
|
Unix = [ BSD Darwin Linux SunOS Hurd Cygwin ];
|
2017-05-21 19:39:23 +02:00
|
|
|
|
|
|
|
Darwin = { kernel = kernels.darwin; };
|
|
|
|
Linux = { kernel = kernels.linux; };
|
|
|
|
SunOS = { kernel = kernels.solaris; };
|
|
|
|
FreeBSD = { kernel = kernels.freebsd; };
|
2017-05-22 18:42:03 +02:00
|
|
|
Hurd = { kernel = kernels.hurd; };
|
2017-05-21 19:39:23 +02:00
|
|
|
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; };
|
|
|
|
|
2017-06-12 19:27:10 +02:00
|
|
|
Arm32 = recursiveUpdate Arm patterns."32bit";
|
|
|
|
Arm64 = recursiveUpdate Arm patterns."64bit";
|
2017-05-21 19:39:23 +02:00
|
|
|
};
|
|
|
|
|
2017-06-12 19:27:10 +02:00
|
|
|
matchAnyAttrs = patterns:
|
|
|
|
if builtins.isList patterns then attrs: any (pattern: matchAttrs pattern attrs) patterns
|
|
|
|
else matchAttrs patterns;
|
|
|
|
|
2017-05-21 19:39:23 +02:00
|
|
|
predicates = mapAttrs'
|
2017-06-12 19:27:10 +02:00
|
|
|
(name: value: nameValuePair ("is" + name) (matchAnyAttrs value))
|
2017-05-21 19:39:23 +02:00
|
|
|
patterns;
|
|
|
|
}
|