2019-05-02 18:13:16 +00:00
|
|
|
{ target-os, stdenv }:
|
|
|
|
|
2019-07-16 20:34:04 +00:00
|
|
|
# We allow for "none" value because `make shell` can be called with `TARGET_OS` not set.
|
|
|
|
# We don't want to assume `all`, because that will rebuild status-go for all platforms.
|
2019-07-29 08:33:35 +00:00
|
|
|
assert stdenv.lib.assertOneOf "target-os" target-os [
|
|
|
|
"linux"
|
|
|
|
"android"
|
|
|
|
"windows"
|
|
|
|
"macos"
|
|
|
|
"darwin"
|
|
|
|
"ios"
|
|
|
|
"all"
|
|
|
|
"none"
|
|
|
|
];
|
2019-05-02 18:13:16 +00:00
|
|
|
|
|
|
|
let
|
2019-06-04 16:50:29 +00:00
|
|
|
inherit (stdenv) isDarwin isLinux;
|
|
|
|
|
2019-05-02 18:13:16 +00:00
|
|
|
# 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;
|
|
|
|
}
|