top-level: Move default-choosing logic to top-level/platforms.nix
This mirrors stdenv/default.nix
This commit is contained in:
parent
39753f5360
commit
05c12f147e
@ -24,12 +24,11 @@
|
|||||||
config ? {}
|
config ? {}
|
||||||
|
|
||||||
, crossSystem ? null
|
, crossSystem ? null
|
||||||
, platform ? null
|
, platform ? assert false; null
|
||||||
} @ args:
|
} @ args:
|
||||||
|
|
||||||
let # Rename the function arguments
|
let # Rename the function arguments
|
||||||
configExpr = config;
|
configExpr = config;
|
||||||
platform_ = platform;
|
|
||||||
|
|
||||||
in let
|
in let
|
||||||
lib = import ../../lib;
|
lib = import ../../lib;
|
||||||
@ -42,21 +41,12 @@ in let
|
|||||||
then configExpr { inherit pkgs; }
|
then configExpr { inherit pkgs; }
|
||||||
else configExpr;
|
else configExpr;
|
||||||
|
|
||||||
# Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc)
|
# Allow setting the platform in the config file. Otherwise, let's use a
|
||||||
|
# reasonable default.
|
||||||
platformAuto = let
|
platform =
|
||||||
platforms = (import ./platforms.nix);
|
args.platform
|
||||||
in
|
or (config.platform
|
||||||
if system == "armv6l-linux" then platforms.raspberrypi
|
or (import ./platforms.nix).selectPlatformBySystem system);
|
||||||
else if system == "armv7l-linux" then platforms.armv7l-hf-multiplatform
|
|
||||||
else if system == "armv5tel-linux" then platforms.sheevaplug
|
|
||||||
else if system == "mips64el-linux" then platforms.fuloong2f_n32
|
|
||||||
else if system == "x86_64-linux" then platforms.pc64
|
|
||||||
else if system == "i686-linux" then platforms.pc32
|
|
||||||
else platforms.pcBase;
|
|
||||||
|
|
||||||
platform = if platform_ != null then platform_
|
|
||||||
else config.platform or platformAuto;
|
|
||||||
|
|
||||||
# A few packages make a new package set to draw their dependencies from.
|
# A few packages make a new package set to draw their dependencies from.
|
||||||
# (Currently to get a cross tool chain, or forced-i686 package.) Rather than
|
# (Currently to get a cross tool chain, or forced-i686 package.) Rather than
|
||||||
|
@ -443,4 +443,12 @@ rec {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
selectPlatformBySystem = system:
|
||||||
|
if system == "armv6l-linux" then raspberrypi
|
||||||
|
else if system == "armv7l-linux" then armv7l-hf-multiplatform
|
||||||
|
else if system == "armv5tel-linux" then sheevaplug
|
||||||
|
else if system == "mips64el-linux" then fuloong2f_n32
|
||||||
|
else if system == "x86_64-linux" then pc64
|
||||||
|
else if system == "i686-linux" then pc32
|
||||||
|
else pcBase;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user