mkSkeletonFromList
lib.systems.parse.mkSkeletonFromList
Docs pulled from | This Revision | 21 minutes ago
Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.
Noogle detected
Implementation
The following is the current implementation of this function.
l:
{
"1" =
if head l == "avr" then
{
cpu = head l;
kernel = "none";
abi = "unknown";
}
else
throw "system string '${lib.concatStringsSep "-" l}' with 1 component is ambiguous";
"2" = # We only do 2-part hacks for things Nix already supports
if elemAt l 1 == "cygwin" then
mkSkeletonFromList [
(head l)
"pc"
"cygwin"
]
# MSVC ought to be the default ABI so this case isn't needed. But then it
# becomes difficult to handle the gnu* variants for Aarch32 correctly for
# minGW. So it's easier to make gnu* the default for the MinGW, but
# hack-in MSVC for the non-MinGW case right here.
else if elemAt l 1 == "windows" then
{
cpu = head l;
kernel = "windows";
abi = "msvc";
}
else if (elemAt l 1) == "elf" then
{
cpu = head l;
vendor = "unknown";
kernel = "none";
abi = elemAt l 1;
}
else
{
cpu = head l;
kernel = elemAt l 1;
};
"3" =
# cpu-kernel-environment
if
elemAt l 1 == "linux"
|| elem (elemAt l 2) [
"eabi"
"eabihf"
"elf"
"gnu"
]
then
{
cpu = head l;
kernel = elemAt l 1;
abi = elemAt l 2;
vendor = "unknown";
}
# cpu-vendor-os
else if
elemAt l 1 == "apple"
|| elem (elemAt l 2) [
"redox"
"mmixware"
"ghcjs"
"mingw32"
"uefi"
]
|| hasPrefix "freebsd" (elemAt l 2)
|| hasPrefix "netbsd" (elemAt l 2)
|| hasPrefix "openbsd" (elemAt l 2)
|| hasPrefix "genode" (elemAt l 2)
|| hasPrefix "wasm32" (elemAt l 0)
then
{
cpu = head l;
vendor = elemAt l 1;
kernel =
if elemAt l 2 == "mingw32" then
"windows" # autotools breaks on -gnu for window
else
elemAt l 2;
}
# lots of tools expect a triplet for Cygwin, even though the vendor is just "pc"
else if elemAt l 2 == "cygwin" then
{
cpu = head l;
vendor = elemAt l 1;
kernel = "cygwin";
}
else
throw "system string '${lib.concatStringsSep "-" l}' with 3 components is ambiguous";
"4" = {
cpu = head l;
vendor = elemAt l 1;
kernel = elemAt l 2;
abi = elemAt l 3;
};
}
.${toString (length l)}
or (throw "system string '${lib.concatStringsSep "-" l}' has invalid number of hyphen-separated components")