lib.systems: add golang platform dialect

This commit is contained in:
aleksana 2025-04-30 19:45:39 +08:00
parent c00afdff9d
commit e1828f9668

View file

@ -531,6 +531,35 @@ let
"-uefi"
];
};
}
// {
go = {
# See https://pkg.go.dev/internal/platform for a list of known platforms
GOARCH =
{
"aarch64" = "arm64";
"arm" = "arm";
"armv5tel" = "arm";
"armv6l" = "arm";
"armv7l" = "arm";
"i686" = "386";
"loongarch64" = "loong64";
"mips" = "mips";
"mips64el" = "mips64le";
"mipsel" = "mipsle";
"powerpc64" = "ppc64";
"powerpc64le" = "ppc64le";
"riscv64" = "riscv64";
"s390x" = "s390x";
"x86_64" = "amd64";
"wasm32" = "wasm";
}
.${final.parsed.cpu.name} or (throw "Unknown CPU variant ${final.parsed.cpu.name} by Go");
GOOS = if final.isWasi then "wasip1" else final.parsed.kernel.name;
# See https://go.dev/wiki/GoArm
GOARM = toString (lib.intersectLists [ (final.parsed.cpu.version or "") ] [ "5" "6" "7" ]);
};
};
in
assert final.useAndroidPrebuilt -> final.isAndroid;