2019-05-02 18:13:16 +00:00
|
|
|
{ target-os, stdenv }:
|
|
|
|
|
2019-06-04 16:50:29 +00:00
|
|
|
assert stdenv.lib.assertOneOf "target-os" target-os [ "linux" "android" "windows" "macos" "darwin" "ios" "all" ];
|
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;
|
|
|
|
}
|