Apply makeOverridable to stdenv
This removes the need for hacks like stdenv.regenerate. It also ensures that overrideGCC is now stackable (so ‘stdenv = useGoldLinker clangStdenv’ works).
This commit is contained in:
parent
7703f04b75
commit
c3d84d15ce
@ -8,20 +8,14 @@ rec {
|
|||||||
|
|
||||||
|
|
||||||
# Override the compiler in stdenv for specific packages.
|
# Override the compiler in stdenv for specific packages.
|
||||||
overrideGCC = stdenv: gcc: stdenv //
|
overrideGCC = stdenv: gcc: stdenv.override { inherit gcc; };
|
||||||
{ mkDerivation = args: stdenv.mkDerivation (args // { NIX_GCC = gcc; });
|
|
||||||
inherit gcc;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
# Add some arbitrary packages to buildInputs for specific packages.
|
# Add some arbitrary packages to buildInputs for specific packages.
|
||||||
# Used to override packages in stdenv like Make. Should not be used
|
# Used to override packages in stdenv like Make. Should not be used
|
||||||
# for other dependencies.
|
# for other dependencies.
|
||||||
overrideInStdenv = stdenv: pkgs: stdenv //
|
overrideInStdenv = stdenv: pkgs:
|
||||||
{ mkDerivation = args: stdenv.mkDerivation (args //
|
stdenv.override (prev: { extraBuildInputs = prev.extraBuildInputs or [] ++ pkgs; });
|
||||||
{ buildInputs = args.buildInputs or [] ++ pkgs; }
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
# Override the setup script of stdenv. Useful for testing new
|
# Override the setup script of stdenv. Useful for testing new
|
||||||
@ -32,7 +26,7 @@ rec {
|
|||||||
# randomPkg = import ../bla { ...
|
# randomPkg = import ../bla { ...
|
||||||
# stdenv = overrideSetup stdenv ../stdenv/generic/setup-latest.sh;
|
# stdenv = overrideSetup stdenv ../stdenv/generic/setup-latest.sh;
|
||||||
# };
|
# };
|
||||||
overrideSetup = stdenv: setup: stdenv.regenerate setup;
|
overrideSetup = stdenv: setupScript: stdenv.override { inherit setupScript; };
|
||||||
|
|
||||||
|
|
||||||
# Return a modified stdenv that uses dietlibc to create small
|
# Return a modified stdenv that uses dietlibc to create small
|
||||||
|
@ -1,9 +1,15 @@
|
|||||||
|
let lib = import ../../../lib; in lib.makeOverridable (
|
||||||
|
|
||||||
{ system, name ? "stdenv", preHook ? "", initialPath, gcc, shell
|
{ system, name ? "stdenv", preHook ? "", initialPath, gcc, shell
|
||||||
, extraAttrs ? {}, overrides ? (pkgs: {}), config
|
, extraAttrs ? {}, overrides ? (pkgs: {}), config
|
||||||
|
|
||||||
, # The `fetchurl' to use for downloading curl and its dependencies
|
, # The `fetchurl' to use for downloading curl and its dependencies
|
||||||
# (see all-packages.nix).
|
# (see all-packages.nix).
|
||||||
fetchurlBoot
|
fetchurlBoot
|
||||||
|
|
||||||
|
, setupScript ? ./setup.sh
|
||||||
|
|
||||||
|
, extraBuildInputs ? []
|
||||||
}:
|
}:
|
||||||
|
|
||||||
if ! builtins ? langVersion then
|
if ! builtins ? langVersion then
|
||||||
@ -14,16 +20,12 @@ else
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
lib = import ../../../lib;
|
|
||||||
|
|
||||||
allowUnfree = config.allowUnfree or true && builtins.getEnv "HYDRA_DISALLOW_UNFREE" != "1";
|
allowUnfree = config.allowUnfree or true && builtins.getEnv "HYDRA_DISALLOW_UNFREE" != "1";
|
||||||
|
|
||||||
allowBroken = builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
|
allowBroken = builtins.getEnv "NIXPKGS_ALLOW_BROKEN" == "1";
|
||||||
|
|
||||||
unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null);
|
unsafeGetAttrPos = builtins.unsafeGetAttrPos or (n: as: null);
|
||||||
|
|
||||||
stdenvGenerator = setupScript: rec {
|
|
||||||
|
|
||||||
# The stdenv that we are producing.
|
# The stdenv that we are producing.
|
||||||
result =
|
result =
|
||||||
|
|
||||||
@ -85,12 +87,10 @@ let
|
|||||||
userHook = config.stdenv.userHook or null;
|
userHook = config.stdenv.userHook or null;
|
||||||
|
|
||||||
# Inputs built by the cross compiler.
|
# Inputs built by the cross compiler.
|
||||||
buildInputs = lib.optionals (crossConfig != null) buildInputs;
|
buildInputs = lib.optionals (crossConfig != null) buildInputs ++ extraBuildInputs;
|
||||||
propagatedBuildInputs = lib.optionals (crossConfig != null)
|
propagatedBuildInputs = lib.optionals (crossConfig != null) propagatedBuildInputs;
|
||||||
propagatedBuildInputs;
|
|
||||||
# Inputs built by the usual native compiler.
|
# Inputs built by the usual native compiler.
|
||||||
nativeBuildInputs = nativeBuildInputs ++ lib.optionals
|
nativeBuildInputs = nativeBuildInputs ++ lib.optionals (crossConfig == null) buildInputs;
|
||||||
(crossConfig == null) buildInputs;
|
|
||||||
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
|
propagatedNativeBuildInputs = propagatedNativeBuildInputs ++
|
||||||
lib.optionals (crossConfig == null) propagatedBuildInputs;
|
lib.optionals (crossConfig == null) propagatedBuildInputs;
|
||||||
}))) (
|
}))) (
|
||||||
@ -156,11 +156,6 @@ let
|
|||||||
|| result.system == "armv6l-linux"
|
|| result.system == "armv6l-linux"
|
||||||
|| result.system == "armv7l-linux";
|
|| result.system == "armv7l-linux";
|
||||||
|
|
||||||
# Utility function: allow stdenv to be easily regenerated with
|
|
||||||
# a different setup script. (See all-packages.nix for an
|
|
||||||
# example.)
|
|
||||||
regenerate = stdenvGenerator;
|
|
||||||
|
|
||||||
# For convenience, bring in the library functions in lib/ so
|
# For convenience, bring in the library functions in lib/ so
|
||||||
# packages don't have to do that themselves.
|
# packages don't have to do that themselves.
|
||||||
inherit lib;
|
inherit lib;
|
||||||
@ -176,7 +171,4 @@ let
|
|||||||
# like curl = if stdenv ? curl then stdenv.curl else ...).
|
# like curl = if stdenv ? curl then stdenv.curl else ...).
|
||||||
// extraAttrs;
|
// extraAttrs;
|
||||||
|
|
||||||
}.result;
|
in result)
|
||||||
|
|
||||||
|
|
||||||
in stdenvGenerator ./setup.sh
|
|
||||||
|
@ -782,12 +782,7 @@ let
|
|||||||
|
|
||||||
despotify = callPackage ../development/libraries/despotify { };
|
despotify = callPackage ../development/libraries/despotify { };
|
||||||
|
|
||||||
dev86 = callPackage ../development/compilers/dev86 {
|
dev86 = callPackage ../development/compilers/dev86 { };
|
||||||
/* Using GNU Make 3.82 leads to this:
|
|
||||||
make[4]: *** No rule to make target `__ldivmod.o)'
|
|
||||||
So use 3.81. */
|
|
||||||
stdenv = overrideInStdenv stdenv [gnumake381];
|
|
||||||
};
|
|
||||||
|
|
||||||
dnsmasq = callPackage ../tools/networking/dnsmasq { };
|
dnsmasq = callPackage ../tools/networking/dnsmasq { };
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user