lib.systems.platforms: Make selection more flexible
We dont have to match on exact strings if we get accessed to `parsed`. Co-authored-by: Matthew Bauer <mjbauer95@gmail.com>
This commit is contained in:
parent
947f27fd0f
commit
40e7be11c8
2 changed files with 19 additions and 14 deletions
|
@ -25,7 +25,7 @@ rec {
|
||||||
system = parse.doubleFromSystem final.parsed;
|
system = parse.doubleFromSystem final.parsed;
|
||||||
config = parse.tripleFromSystem final.parsed;
|
config = parse.tripleFromSystem final.parsed;
|
||||||
# Just a guess, based on `system`
|
# Just a guess, based on `system`
|
||||||
platform = platforms.selectBySystem final.system;
|
platform = platforms.select final;
|
||||||
# Determine whether we are compatible with the provided CPU
|
# Determine whether we are compatible with the provided CPU
|
||||||
isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu;
|
isCompatible = platform: parse.isCompatible final.parsed.cpu platform.parsed.cpu;
|
||||||
# Derived meta-data
|
# Derived meta-data
|
||||||
|
|
|
@ -469,17 +469,22 @@ rec {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
selectBySystem = system: {
|
select = platform:
|
||||||
i486-linux = pc32;
|
# x86
|
||||||
i586-linux = pc32;
|
/**/ if platform.isx86_32 then pc32
|
||||||
i686-linux = pc32;
|
else if platform.isx86_64 then pc64
|
||||||
x86_64-linux = pc64;
|
|
||||||
armv5tel-linux = sheevaplug;
|
# ARM
|
||||||
armv6l-linux = raspberrypi;
|
else if platform.isAarch32 then let
|
||||||
armv7a-linux = armv7l-hf-multiplatform;
|
version = platform.parsed.cpu.version or "";
|
||||||
armv7l-linux = armv7l-hf-multiplatform;
|
in if lib.versionOlder version "6" then sheevaplug
|
||||||
aarch64-linux = aarch64-multiplatform;
|
else if lib.versionOlder version "7" then raspberrypi
|
||||||
mipsel-linux = fuloong2f_n32;
|
else armv7l-hf-multiplatform
|
||||||
powerpc64le-linux = powernv;
|
else if platform.isAarch64 then aarch64-multiplatform
|
||||||
}.${system} or pcBase;
|
|
||||||
|
else if platform.parsed.cpu == lib.systems.parse.cpuTypes.mipsel then fuloong2f_n32
|
||||||
|
|
||||||
|
else if platform.parsed.cpu == lib.systems.parse.cpuTypes.powerpc64le then powernv
|
||||||
|
|
||||||
|
else pcBase;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue