top-level: Modernize stdenv.overrides giving it self and super
Document breaking change in 17.03 release notes
This commit is contained in:
parent
f673243aff
commit
0ef8b69d12
7 changed files with 49 additions and 42 deletions
|
@ -28,6 +28,14 @@ has the following highlights: </para>
|
|||
following incompatible changes:</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>stdenv.overrides</literal> is now expected to take <literal>self</literal>
|
||||
and <literal>super</literal> arguments. See <literal>lib.trivial.extends</literal>
|
||||
for what those parameters represent.
|
||||
</para>
|
||||
</listitem>
|
||||
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>gnome</literal> alias has been removed along with
|
||||
|
|
|
@ -54,7 +54,7 @@ in rec {
|
|||
};
|
||||
|
||||
stageFun = step: last: {shell ? "${bootstrapTools}/bin/sh",
|
||||
overrides ? (pkgs: {}),
|
||||
overrides ? (self: super: {}),
|
||||
extraPreHook ? "",
|
||||
extraBuildInputs,
|
||||
allowedRequisites ? null}:
|
||||
|
@ -96,7 +96,7 @@ in rec {
|
|||
extraSandboxProfile = binShClosure + libSystemProfile;
|
||||
|
||||
extraAttrs = { inherit platform; parent = last; };
|
||||
overrides = pkgs: (overrides pkgs) // { fetchurl = thisStdenv.fetchurlBoot; };
|
||||
overrides = self: super: (overrides self super) // { fetchurl = thisStdenv.fetchurlBoot; };
|
||||
};
|
||||
|
||||
thisPkgs = allPackages {
|
||||
|
@ -107,8 +107,8 @@ in rec {
|
|||
in { stdenv = thisStdenv; pkgs = thisPkgs; };
|
||||
|
||||
stage0 = stageFun 0 null {
|
||||
overrides = orig: with stage0; rec {
|
||||
darwin = orig.darwin // {
|
||||
overrides = self: super: with stage0; rec {
|
||||
darwin = super.darwin // {
|
||||
Libsystem = stdenv.mkDerivation {
|
||||
name = "bootstrap-Libsystem";
|
||||
buildCommand = ''
|
||||
|
@ -145,7 +145,7 @@ in rec {
|
|||
extraBuildInputs = [];
|
||||
};
|
||||
|
||||
persistent0 = _: {};
|
||||
persistent0 = _: _: {};
|
||||
|
||||
stage1 = with stage0; stageFun 1 stage0 {
|
||||
extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
|
||||
|
@ -157,14 +157,14 @@ in rec {
|
|||
overrides = persistent0;
|
||||
};
|
||||
|
||||
persistent1 = orig: with stage1.pkgs; {
|
||||
persistent1 = self: super: with stage1.pkgs; {
|
||||
inherit
|
||||
zlib patchutils m4 scons flex perl bison unifdef unzip openssl icu python
|
||||
libxml2 gettext sharutils gmp libarchive ncurses pkg-config libedit groff
|
||||
openssh sqlite sed serf openldap db cyrus-sasl expat apr-util subversion xz
|
||||
findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils;
|
||||
|
||||
darwin = orig.darwin // {
|
||||
darwin = super.darwin // {
|
||||
inherit (darwin)
|
||||
dyld Libsystem xnu configd libdispatch libclosure launchd;
|
||||
};
|
||||
|
@ -185,7 +185,7 @@ in rec {
|
|||
overrides = persistent1;
|
||||
};
|
||||
|
||||
persistent2 = orig: with stage2.pkgs; {
|
||||
persistent2 = self: super: with stage2.pkgs; {
|
||||
inherit
|
||||
patchutils m4 scons flex perl bison unifdef unzip openssl python
|
||||
gettext sharutils libarchive pkg-config groff bash subversion
|
||||
|
@ -193,7 +193,7 @@ in rec {
|
|||
findfreetype libssh curl cmake autoconf automake libtool cpio
|
||||
libcxx libcxxabi;
|
||||
|
||||
darwin = orig.darwin // {
|
||||
darwin = super.darwin // {
|
||||
inherit (darwin)
|
||||
dyld Libsystem xnu configd libdispatch libclosure launchd libiconv locale;
|
||||
};
|
||||
|
@ -221,19 +221,19 @@ in rec {
|
|||
overrides = persistent2;
|
||||
};
|
||||
|
||||
persistent3 = orig: with stage3.pkgs; {
|
||||
persistent3 = self: super: with stage3.pkgs; {
|
||||
inherit
|
||||
gnumake gzip gnused bzip2 gawk ed xz patch bash
|
||||
libcxxabi libcxx ncurses libffi zlib gmp pcre gnugrep
|
||||
coreutils findutils diffutils patchutils;
|
||||
|
||||
llvmPackages = let llvmOverride = llvmPackages.llvm.override { inherit libcxxabi; };
|
||||
in orig.llvmPackages // {
|
||||
in super.llvmPackages // {
|
||||
llvm = llvmOverride;
|
||||
clang-unwrapped = llvmPackages.clang-unwrapped.override { llvm = llvmOverride; };
|
||||
};
|
||||
|
||||
darwin = orig.darwin // {
|
||||
darwin = super.darwin // {
|
||||
inherit (darwin) dyld Libsystem libiconv locale;
|
||||
};
|
||||
};
|
||||
|
@ -247,17 +247,17 @@ in rec {
|
|||
overrides = persistent3;
|
||||
};
|
||||
|
||||
persistent4 = orig: with stage4.pkgs; {
|
||||
persistent4 = self: super: with stage4.pkgs; {
|
||||
inherit
|
||||
gnumake gzip gnused bzip2 gawk ed xz patch bash
|
||||
libcxxabi libcxx ncurses libffi zlib icu llvm gmp pcre gnugrep
|
||||
coreutils findutils diffutils patchutils binutils binutils-raw;
|
||||
|
||||
llvmPackages = orig.llvmPackages // {
|
||||
llvmPackages = super.llvmPackages // {
|
||||
inherit (llvmPackages) llvm clang-unwrapped;
|
||||
};
|
||||
|
||||
darwin = orig.darwin // {
|
||||
darwin = super.darwin // {
|
||||
inherit (darwin) dyld Libsystem cctools libiconv;
|
||||
};
|
||||
};
|
||||
|
@ -307,7 +307,7 @@ in rec {
|
|||
dyld Libsystem CF cctools libiconv locale
|
||||
]);
|
||||
|
||||
overrides = orig: persistent4 orig // {
|
||||
overrides = self: super: persistent4 self super // {
|
||||
clang = cc;
|
||||
inherit cc;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
let lib = import ../../../lib; in lib.makeOverridable (
|
||||
|
||||
{ system, name ? "stdenv", preHook ? "", initialPath, cc, shell
|
||||
, allowedRequisites ? null, extraAttrs ? {}, overrides ? (pkgs: {}), config
|
||||
, allowedRequisites ? null, extraAttrs ? {}, overrides ? (self: super: {}), config
|
||||
|
||||
, # The `fetchurl' to use for downloading curl and its dependencies
|
||||
# (see all-packages.nix).
|
||||
|
|
|
@ -44,7 +44,7 @@ rec {
|
|||
# the bootstrap. In all stages, we build an stdenv and the package
|
||||
# set that can be built with that stdenv.
|
||||
stageFun =
|
||||
{gccPlain, glibc, binutils, coreutils, gnugrep, name, overrides ? (pkgs: {}), extraBuildInputs ? []}:
|
||||
{gccPlain, glibc, binutils, coreutils, gnugrep, name, overrides ? (self: super: {}), extraBuildInputs ? []}:
|
||||
|
||||
let
|
||||
|
||||
|
@ -87,7 +87,7 @@ rec {
|
|||
# /usr/include directory.
|
||||
inherit glibc;
|
||||
};
|
||||
overrides = pkgs: (overrides pkgs) // { fetchurl = thisStdenv.fetchurlBoot; };
|
||||
overrides = self: super: (overrides self super) // { fetchurl = thisStdenv.fetchurlBoot; };
|
||||
};
|
||||
|
||||
thisPkgs = allPackages {
|
||||
|
@ -109,13 +109,13 @@ rec {
|
|||
gnugrep = null;
|
||||
name = null;
|
||||
|
||||
overrides = pkgs: {
|
||||
overrides = self: super: {
|
||||
# The Glibc include directory cannot have the same prefix as the
|
||||
# GCC include directory, since GCC gets confused otherwise (it
|
||||
# will search the Glibc headers before the GCC headers). So
|
||||
# create a dummy Glibc here, which will be used in the stdenv of
|
||||
# stage1.
|
||||
glibc = stage0.stdenv.mkDerivation {
|
||||
glibc = self.stdenv.mkDerivation {
|
||||
name = "bootstrap-glibc";
|
||||
buildCommand = ''
|
||||
mkdir -p $out
|
||||
|
@ -146,8 +146,8 @@ rec {
|
|||
name = "bootstrap-gcc-wrapper";
|
||||
|
||||
# Rebuild binutils to use from stage2 onwards.
|
||||
overrides = pkgs: {
|
||||
binutils = pkgs.binutils.override { gold = false; };
|
||||
overrides = self: super: {
|
||||
binutils = super.binutils.override { gold = false; };
|
||||
inherit (stage0.pkgs) glibc;
|
||||
|
||||
# A threaded perl build needs glibc/libpthread_nonshared.a,
|
||||
|
@ -155,7 +155,7 @@ rec {
|
|||
# This is not an issue for the final stdenv, because this perl
|
||||
# won't be included in the final stdenv and won't be exported to
|
||||
# top-level pkgs as an override either.
|
||||
perl = pkgs.perl.override { enableThreading = false; };
|
||||
perl = super.perl.override { enableThreading = false; };
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -170,7 +170,7 @@ rec {
|
|||
gnugrep = bootstrapTools;
|
||||
name = "bootstrap-gcc-wrapper";
|
||||
|
||||
overrides = pkgs: {
|
||||
overrides = self: super: {
|
||||
inherit (stage1.pkgs) perl binutils paxctl gnum4 bison;
|
||||
# This also contains the full, dynamically linked, final Glibc.
|
||||
};
|
||||
|
@ -187,16 +187,16 @@ rec {
|
|||
gnugrep = bootstrapTools;
|
||||
name = "bootstrap-gcc-wrapper";
|
||||
|
||||
overrides = pkgs: rec {
|
||||
overrides = self: super: rec {
|
||||
inherit (stage2.pkgs) binutils glibc perl patchelf linuxHeaders gnum4 bison;
|
||||
# Link GCC statically against GMP etc. This makes sense because
|
||||
# these builds of the libraries are only used by GCC, so it
|
||||
# reduces the size of the stdenv closure.
|
||||
gmp = pkgs.gmp.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
|
||||
mpfr = pkgs.mpfr.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
|
||||
libmpc = pkgs.libmpc.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
|
||||
isl_0_14 = pkgs.isl_0_14.override { stdenv = pkgs.makeStaticLibraries pkgs.stdenv; };
|
||||
gccPlain = pkgs.gcc.cc.override {
|
||||
gmp = super.gmp.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
||||
mpfr = super.mpfr.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
||||
libmpc = super.libmpc.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
||||
isl_0_14 = super.isl_0_14.override { stdenv = self.makeStaticLibraries self.stdenv; };
|
||||
gccPlain = super.gcc.cc.override {
|
||||
isl = isl_0_14;
|
||||
};
|
||||
};
|
||||
|
@ -212,7 +212,7 @@ rec {
|
|||
coreutils = bootstrapTools;
|
||||
name = "";
|
||||
|
||||
overrides = pkgs: {
|
||||
overrides = self: super: {
|
||||
# Zlib has to be inherited and not rebuilt in this stage,
|
||||
# because gcc (since JAR support) already depends on zlib, and
|
||||
# then if we already have a zlib we want to use that for the
|
||||
|
@ -223,12 +223,11 @@ rec {
|
|||
nativeTools = false;
|
||||
nativeLibc = false;
|
||||
isGNU = true;
|
||||
cc = stage4.stdenv.cc.cc;
|
||||
libc = stage4.pkgs.glibc;
|
||||
inherit (stage4.pkgs) binutils coreutils gnugrep;
|
||||
cc = self.stdenv.cc.cc;
|
||||
libc = self.glibc;
|
||||
inherit (self) stdenv binutils coreutils gnugrep;
|
||||
name = "";
|
||||
stdenv = stage4.stdenv;
|
||||
shell = stage4.pkgs.bash + "/bin/bash";
|
||||
shell = self.bash + "/bin/bash";
|
||||
};
|
||||
};
|
||||
extraBuildInputs = [ stage3.pkgs.patchelf stage3.pkgs.xz ];
|
||||
|
@ -278,7 +277,7 @@ rec {
|
|||
];
|
||||
*/
|
||||
|
||||
overrides = pkgs: {
|
||||
overrides = self: super: {
|
||||
gcc = cc;
|
||||
|
||||
inherit (stage4.pkgs)
|
||||
|
|
|
@ -77,7 +77,7 @@ rec {
|
|||
# A function that builds a "native" stdenv (one that uses tools in
|
||||
# /usr etc.).
|
||||
makeStdenv =
|
||||
{ cc, fetchurl, extraPath ? [], overrides ? (pkgs: { }) }:
|
||||
{ cc, fetchurl, extraPath ? [], overrides ? (self: super: { }) }:
|
||||
|
||||
import ../generic {
|
||||
preHook =
|
||||
|
@ -142,7 +142,7 @@ rec {
|
|||
stdenvBoot2 = makeStdenv {
|
||||
inherit cc fetchurl;
|
||||
extraPath = [ stdenvBoot1Pkgs.xz ];
|
||||
overrides = pkgs: { inherit (stdenvBoot1Pkgs) xz; };
|
||||
overrides = self: super: { inherit (stdenvBoot1Pkgs) xz; };
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ import ../generic rec {
|
|||
|
||||
fetchurlBoot = stdenv.fetchurlBoot;
|
||||
|
||||
overrides = pkgs_: {
|
||||
overrides = self: super: {
|
||||
inherit cc;
|
||||
inherit (cc) binutils;
|
||||
inherit (pkgs)
|
||||
|
|
|
@ -67,7 +67,7 @@ let
|
|||
# crossStdenv adapter.
|
||||
stdenvOverrides = self: super:
|
||||
lib.optionalAttrs (crossSystem == null && super.stdenv ? overrides)
|
||||
(super.stdenv.overrides super);
|
||||
(super.stdenv.overrides self super);
|
||||
|
||||
# Allow packages to be overridden globally via the `packageOverrides'
|
||||
# configuration option, which must be a function that takes `pkgs'
|
||||
|
|
Loading…
Reference in a new issue