2016-03-20 17:28:18 +01:00
|
|
|
/* This file composes the Nix Packages collection. That is, it
|
|
|
|
imports the functions that build the various packages, and calls
|
|
|
|
them with appropriate arguments. The result is a set of all the
|
|
|
|
packages in the Nix Packages collection for some particular
|
|
|
|
platform. */
|
|
|
|
|
|
|
|
{ # The system (e.g., `i686-linux') for which to build the packages.
|
2016-04-26 19:53:31 +02:00
|
|
|
system
|
2016-03-20 17:28:18 +01:00
|
|
|
|
2016-04-26 19:53:31 +02:00
|
|
|
, # Allow a configuration attribute set to be passed in as an argument.
|
|
|
|
config ? {}
|
2016-03-20 17:28:18 +01:00
|
|
|
|
|
|
|
, crossSystem ? null
|
|
|
|
, platform ? null
|
2016-11-27 21:32:56 +01:00
|
|
|
, ...
|
2016-11-02 21:39:18 +01:00
|
|
|
} @ args:
|
2016-03-20 17:28:18 +01:00
|
|
|
|
2016-11-27 21:32:56 +01:00
|
|
|
let # Rename the function arguments
|
|
|
|
configExpr = config;
|
|
|
|
platform_ = platform;
|
2016-03-20 17:28:18 +01:00
|
|
|
|
2016-11-27 21:32:56 +01:00
|
|
|
in let
|
2016-03-20 17:28:18 +01:00
|
|
|
lib = import ../../lib;
|
|
|
|
|
2016-06-22 10:33:53 +02:00
|
|
|
# Allow both:
|
|
|
|
# { /* the config */ } and
|
|
|
|
# { pkgs, ... } : { /* the config */ }
|
2016-03-20 17:28:18 +01:00
|
|
|
config =
|
2016-06-22 10:33:53 +02:00
|
|
|
if builtins.isFunction configExpr
|
|
|
|
then configExpr { inherit pkgs; }
|
|
|
|
else configExpr;
|
2016-03-20 17:28:18 +01:00
|
|
|
|
|
|
|
# Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc)
|
|
|
|
|
|
|
|
platformAuto = let
|
|
|
|
platforms = (import ./platforms.nix);
|
|
|
|
in
|
|
|
|
if system == "armv6l-linux" then platforms.raspberrypi
|
|
|
|
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;
|
|
|
|
|
2016-11-02 21:39:18 +01:00
|
|
|
# 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
|
|
|
|
# give `all-packages.nix` all the arguments to this function, even ones that
|
|
|
|
# don't concern it, we give it this function to "re-call" nixpkgs, inheriting
|
|
|
|
# whatever arguments it doesn't explicitly provide. This way,
|
|
|
|
# `all-packages.nix` doesn't know more than it needs too.
|
|
|
|
#
|
|
|
|
# It's OK that `args` doesn't include the defaults: they'll be
|
|
|
|
# deterministically inferred the same way.
|
|
|
|
nixpkgsFun = newArgs: import ./. (args // newArgs);
|
|
|
|
|
2016-11-27 21:32:56 +01:00
|
|
|
pkgs = import ./stage.nix ({
|
|
|
|
inherit lib nixpkgsFun config platform;
|
|
|
|
} // args);
|
2016-10-12 21:14:49 +02:00
|
|
|
|
|
|
|
in pkgs
|