forked from mirrors/nixpkgs
f5dfe78a1e
This patch add a new argument to Nixpkgs default expression named "overlays". By default, the value of the argument is either taken from the environment variable `NIXPKGS_OVERLAYS`, or from the directory `~/.nixpkgs/overlays/`. If the environment variable does not name a valid directory then this mechanism would fallback on the home directory. If the home directory does not exists it will fallback on an empty list of overlays. The overlays directory should contain the list of extra Nixpkgs stages which would be used to extend the content of Nixpkgs, with additional set of packages. The overlays, i-e directory, files, symbolic links are used in alphabetical order. The simplest overlay which extends Nixpkgs with nothing looks like: ```nix self: super: { } ``` More refined overlays can use `super` as the basis for building new packages, and `self` as a way to query the final result of the fix-point. An example of overlay which extends Nixpkgs with a small set of packages can be found at: https://github.com/nbp/nixpkgs-mozilla/blob/nixpkgs-overlay/moz-overlay.nix To use this file, checkout the repository and add a symbolic link to the `moz-overlay.nix` file in `~/.nixpkgs/overlays` directory.
50 lines
1.5 KiB
Nix
50 lines
1.5 KiB
Nix
{ lib
|
|
, system, platform, crossSystem, config, overlays
|
|
}:
|
|
|
|
let
|
|
bootStages = import ../. {
|
|
inherit lib system platform overlays;
|
|
crossSystem = null;
|
|
# Ignore custom stdenvs when cross compiling for compatability
|
|
config = builtins.removeAttrs config [ "replaceStdenv" ];
|
|
};
|
|
|
|
in bootStages ++ [
|
|
|
|
# Build Packages.
|
|
#
|
|
# For now, this is just used to build the native stdenv. Eventually, it
|
|
# should be used to build compilers and other such tools targeting the cross
|
|
# platform. Then, `forceNativeDrv` can be removed.
|
|
(vanillaPackages: {
|
|
inherit system platform crossSystem config overlays;
|
|
# It's OK to change the built-time dependencies
|
|
allowCustomOverrides = true;
|
|
stdenv = vanillaPackages.stdenv // {
|
|
# Needed elsewhere as a hacky way to pass the target
|
|
cross = crossSystem;
|
|
overrides = _: _: {};
|
|
};
|
|
})
|
|
|
|
# Run packages
|
|
(buildPackages: {
|
|
inherit system platform crossSystem config overlays;
|
|
stdenv = if crossSystem.useiOSCross or false
|
|
then let
|
|
inherit (buildPackages.darwin.ios-cross {
|
|
prefix = crossSystem.config;
|
|
inherit (crossSystem) arch;
|
|
simulator = crossSystem.isiPhoneSimulator or false; })
|
|
cc binutils;
|
|
in buildPackages.makeStdenvCross
|
|
buildPackages.stdenv crossSystem
|
|
binutils cc
|
|
else buildPackages.makeStdenvCross
|
|
buildPackages.stdenv crossSystem
|
|
buildPackages.binutilsCross buildPackages.gccCrossStageFinal;
|
|
})
|
|
|
|
]
|