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