on e94de40 help sign in
haskell.nix/lib/host-map.nix
34 lines 1.6 kB history raw
1stdenv:
2# set a few default values so we don't depend on what's exported from
3# hostPlatform from whatever nixpkgs set we are working against.
4with { isLinux = false; isWindows = false; isDarwin = false; isFreeBSD = false;
5 isOpenBSD = false; isNetBSD = false; isiOS = false; isAndroid = false;
6 isGhcjs = false; isAsterius = false; isHurd = false;
7 isx86 = false; isPowerPC = false; isAarch32 = false; isAarch64 = false;
8 isMips = false; isWasm = false; isJavaScript = false;
9 is32bit = false; is64bit = false; };
10with stdenv.hostPlatform; {
11 os = if isLinux then "Linux" else
12 if isWindows then "Windows" else
13 if isDarwin then "Osx" else
14 if isFreeBSD then "Freebsd" else
15 if isOpenBSD then "Openbsd" else
16 if isNetBSD then "Netbsd" else
17 if isHurd then "Hurd" else
18 if isiOS then "Ios" else
19 if isAndroid then "Android" else
20 if isGhcjs then "Ghcjs" else
21 if isAsterius then "Asterius" else
22 throw "Unknown OS";
23 arch = if isx86 && is32bit then "I386" else
24 if isx86 && is64bit then "X86_64" else
25 if isPowerPC && is32bit then "PPC" else
26 if isPowerPC && is64bit then "PPC64" else
27 if isAarch32 then "Arm" else
28 if isAarch64 then "Aarch64" else
29 if isMips then "Mips" else
30 if isWasm && is32bit then "Wasm32" else
31 if isWasm && is64bit then "Wasm64" else
32 if isJavaScript then "JavaScript" else
33 throw "Unknown Arch";