2016-03-20 16:28:18 +00: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 18:53:31 +01:00
|
|
|
system
|
2016-03-20 16:28:18 +00:00
|
|
|
|
|
|
|
, # The standard environment to use. Only used for bootstrapping. If
|
|
|
|
# null, the default standard environment is used.
|
|
|
|
bootStdenv ? null
|
|
|
|
|
2016-11-07 05:27:38 +00:00
|
|
|
, # This is used because stdenv replacement and the stdenvCross do benefit from
|
|
|
|
# the overridden configuration provided by the user, as opposed to the normal
|
|
|
|
# bootstrapping stdenvs.
|
|
|
|
allowCustomOverrides ? (bootStdenv == null)
|
|
|
|
|
2016-03-20 16:28:18 +00:00
|
|
|
, # Non-GNU/Linux OSes are currently "impure" platforms, with their libc
|
|
|
|
# outside of the store. Thus, GCC, GFortran, & co. must always look for
|
|
|
|
# files in standard system directories (/usr/include, etc.)
|
|
|
|
noSysDirs ? (system != "x86_64-freebsd" && system != "i686-freebsd"
|
|
|
|
&& system != "x86_64-solaris"
|
|
|
|
&& system != "x86_64-kfreebsd-gnu")
|
|
|
|
|
2016-04-26 18:53:31 +01:00
|
|
|
, # Allow a configuration attribute set to be passed in as an argument.
|
|
|
|
config ? {}
|
2016-03-20 16:28:18 +00:00
|
|
|
|
|
|
|
, crossSystem ? null
|
|
|
|
, platform ? null
|
2016-11-02 20:39:18 +00:00
|
|
|
} @ args:
|
2016-03-20 16:28:18 +00:00
|
|
|
|
|
|
|
|
2016-06-22 09:33:53 +01:00
|
|
|
let configExpr = config; platform_ = platform; in # rename the function arguments
|
2016-03-20 16:28:18 +00:00
|
|
|
|
|
|
|
let
|
|
|
|
lib = import ../../lib;
|
|
|
|
|
2016-06-22 09:33:53 +01:00
|
|
|
# Allow both:
|
|
|
|
# { /* the config */ } and
|
|
|
|
# { pkgs, ... } : { /* the config */ }
|
2016-03-20 16:28:18 +00:00
|
|
|
config =
|
2016-06-22 09:33:53 +01:00
|
|
|
if builtins.isFunction configExpr
|
|
|
|
then configExpr { inherit pkgs; }
|
|
|
|
else configExpr;
|
2016-03-20 16:28:18 +00: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 20:39:18 +00: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-10-12 20:14:49 +01:00
|
|
|
stdenvAdapters = self: super:
|
|
|
|
let res = import ../stdenv/adapters.nix self; in res // {
|
|
|
|
stdenvAdapters = res;
|
|
|
|
};
|
|
|
|
|
|
|
|
trivialBuilders = self: super:
|
2016-10-28 05:01:50 +01:00
|
|
|
import ../build-support/trivial-builders.nix {
|
2016-10-12 20:14:49 +01:00
|
|
|
inherit lib; inherit (self) stdenv stdenvNoCC; inherit (self.xorg) lndir;
|
2016-10-28 05:01:50 +01:00
|
|
|
};
|
2016-10-12 20:14:49 +01:00
|
|
|
|
2016-11-02 22:35:03 +00:00
|
|
|
stdenvDefault = self: super:
|
|
|
|
import ./stdenv.nix {
|
2016-04-27 16:09:12 +01:00
|
|
|
inherit system bootStdenv crossSystem config platform lib nixpkgsFun;
|
2016-11-02 22:35:03 +00:00
|
|
|
};
|
2016-10-12 20:14:49 +01:00
|
|
|
|
|
|
|
allPackages = self: super:
|
2016-11-02 22:35:03 +00:00
|
|
|
let res = import ./all-packages.nix
|
2016-11-02 21:08:39 +00:00
|
|
|
{ inherit system noSysDirs config crossSystem platform lib nixpkgsFun; }
|
2016-11-02 22:35:03 +00:00
|
|
|
res self;
|
2016-10-12 20:14:49 +01:00
|
|
|
in res;
|
|
|
|
|
|
|
|
aliases = self: super: import ./aliases.nix super;
|
|
|
|
|
|
|
|
# stdenvOverrides is used to avoid circular dependencies for building
|
|
|
|
# the standard build environment. This mechanism uses the override
|
|
|
|
# mechanism to implement some staged compilation of the stdenv.
|
|
|
|
#
|
|
|
|
# We don't want stdenv overrides in the case of cross-building, or
|
|
|
|
# otherwise the basic overridden packages will not be built with the
|
|
|
|
# crossStdenv adapter.
|
|
|
|
stdenvOverrides = self: super:
|
|
|
|
lib.optionalAttrs (crossSystem == null && super.stdenv ? overrides)
|
|
|
|
(super.stdenv.overrides super);
|
|
|
|
|
2016-03-20 20:03:18 +00:00
|
|
|
# Allow packages to be overridden globally via the `packageOverrides'
|
2016-03-20 16:28:18 +00:00
|
|
|
# configuration option, which must be a function that takes `pkgs'
|
2016-03-20 20:03:18 +00:00
|
|
|
# as an argument and returns a set of new or overridden packages.
|
2016-03-20 16:28:18 +00:00
|
|
|
# The `packageOverrides' function is called with the *original*
|
2016-03-20 20:03:18 +00:00
|
|
|
# (un-overridden) set of packages, allowing packageOverrides
|
2016-03-20 16:28:18 +00:00
|
|
|
# attributes to refer to the original attributes (e.g. "foo =
|
|
|
|
# ... pkgs.foo ...").
|
2016-10-12 20:14:49 +01:00
|
|
|
configOverrides = self: super:
|
2016-11-07 05:27:38 +00:00
|
|
|
lib.optionalAttrs allowCustomOverrides
|
2016-10-12 20:14:49 +01:00
|
|
|
((config.packageOverrides or (super: {})) super);
|
|
|
|
|
2016-10-13 16:02:56 +01:00
|
|
|
# The complete chain of package set builders, applied from top to bottom
|
|
|
|
toFix = lib.foldl' (lib.flip lib.extends) (self: {}) [
|
2016-10-12 20:14:49 +01:00
|
|
|
stdenvAdapters
|
2016-10-13 16:02:56 +01:00
|
|
|
trivialBuilders
|
|
|
|
stdenvDefault
|
|
|
|
allPackages
|
|
|
|
aliases
|
|
|
|
stdenvOverrides
|
|
|
|
configOverrides
|
2016-10-12 20:14:49 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
# Use `overridePackages` to easily override this package set.
|
|
|
|
# Warning: this function is very expensive and must not be used
|
|
|
|
# from within the nixpkgs repository.
|
|
|
|
#
|
|
|
|
# Example:
|
|
|
|
# pkgs.overridePackages (self: super: {
|
|
|
|
# foo = super.foo.override { ... };
|
|
|
|
# }
|
|
|
|
#
|
|
|
|
# The result is `pkgs' where all the derivations depending on `foo'
|
|
|
|
# will use the new version.
|
|
|
|
|
|
|
|
# Return the complete set of packages. Warning: this function is very
|
|
|
|
# expensive!
|
|
|
|
pkgs = lib.makeExtensibleWithCustomName "overridePackages" toFix;
|
|
|
|
in pkgs
|