status-react/nix/platform.nix
Pedro Pombeiro 49fbf21f8d
Split status-go Nix package per platform so rebuilds are faster
Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
2019-05-06 14:40:23 +02:00

49 lines
1.2 KiB
Nix

{ target-os, stdenv }:
with stdenv;
assert lib.assertOneOf "target-os" target-os [ "linux" "android" "windows" "macos" "darwin" "ios" "all" ];
let
# based on the value passed in through target-os, check if we're targetting a desktop platform
targetDesktop = {
"linux" = true;
"windows" = true;
"macos" = true;
"darwin" = true;
"all" = true;
}.${target-os} or false;
# based on the value passed in through target-os, check if we're targetting a mobile platform
targetMobile = {
"android" = true;
"ios" = true;
"all" = true;
}.${target-os} or false;
targetAndroid = {
"android" = true;
"all" = true;
}.${target-os} or false;
targetIOS = {
"ios" = true;
"all" = isDarwin;
}.${target-os} or false;
targetLinux = {
"linux" = true;
"all" = isLinux;
}.${target-os} or false;
targetDarwin = {
"macos" = true;
"darwin" = true;
"all" = isDarwin;
}.${target-os} or false;
targetWindows = {
"windows" = true;
"all" = isLinux;
}.${target-os} or false;
in {
inherit targetDesktop targetMobile;
inherit targetAndroid targetIOS;
inherit targetLinux targetDarwin targetWindows;
}