From edbbddce1da7928f44bceaa7cda5aaf369e09e5d Mon Sep 17 00:00:00 2001 From: Michael Raskin <7c6f434c@mail.ru> Date: Tue, 6 Oct 2009 05:43:51 +0000 Subject: [PATCH] A case study in transitive overrides. WebKit needs fresh glib. This means it needs a whole slice of system built against glib-2.22.. Added overrides are generic enough, though. So the same way can be used to override everything. I have failed (so far?) to add mkOverridable into stdenv, though. svn path=/nixpkgs/trunk/; revision=17661 --- pkgs/development/libraries/avahi/default.nix | 2 +- .../libraries/consolekit/default.nix | 3 +- .../libraries/gstreamer/default.nix | 10 +-- .../gstreamer/gst-ffmpeg/default.nix | 2 +- .../gstreamer/gst-plugins-base/default.nix | 2 +- .../gstreamer/gst-plugins-good/default.nix | 2 +- .../libraries/gstreamer/gstreamer/default.nix | 2 +- .../development/libraries/libjpeg/default.nix | 2 +- pkgs/development/libraries/liboil/default.nix | 2 +- .../development/libraries/libxml2/default.nix | 2 +- .../libraries/policykit/default.nix | 2 +- pkgs/os-specific/linux/udev/default.nix | 3 +- .../linux/util-linux-ng/default.nix | 2 +- pkgs/servers/pulseaudio/default.nix | 2 +- pkgs/top-level/all-packages.nix | 78 +++++++++++-------- 15 files changed, 66 insertions(+), 50 deletions(-) diff --git a/pkgs/development/libraries/avahi/default.nix b/pkgs/development/libraries/avahi/default.nix index cca6095616ba..ad7ba37568bd 100644 --- a/pkgs/development/libraries/avahi/default.nix +++ b/pkgs/development/libraries/avahi/default.nix @@ -1,6 +1,6 @@ { fetchurl, stdenv, pkgconfig, libdaemon, dbus, perl, perlXMLParser , expat, gettext, intltool, glib, gtk, qt4 ? null, lib -, qt4Support ? false }: +, qt4Support ? false, ...}: assert qt4Support -> qt4 != null; diff --git a/pkgs/development/libraries/consolekit/default.nix b/pkgs/development/libraries/consolekit/default.nix index f93278531266..f41e8c6fbd1b 100644 --- a/pkgs/development/libraries/consolekit/default.nix +++ b/pkgs/development/libraries/consolekit/default.nix @@ -1,4 +1,5 @@ -{ stdenv, fetchurl, pkgconfig, dbus_glib, zlib, pam, glib, libX11, policykit, expat }: +{ stdenv, fetchurl, pkgconfig, dbus_glib, zlib, pam, glib, + libX11, policykit, expat, ... }: stdenv.mkDerivation rec { name = "consolekit-0.2.10"; diff --git a/pkgs/development/libraries/gstreamer/default.nix b/pkgs/development/libraries/gstreamer/default.nix index a765510e7c0a..2170bcd845bf 100644 --- a/pkgs/development/libraries/gstreamer/default.nix +++ b/pkgs/development/libraries/gstreamer/default.nix @@ -1,29 +1,29 @@ args: with args; rec { - gstreamer = import ./gstreamer { + gstreamer = makeOverridable (import ./gstreamer) { inherit (args) fetchurl stdenv perl bison flex pkgconfig python which gtkdoc glib libxml2; }; - gstPluginsBase = import ./gst-plugins-base { + gstPluginsBase = makeOverridable (import ./gst-plugins-base) { inherit gstreamer; inherit (args) fetchurl stdenv pkgconfig python libX11 libXv libXext alsaLib cdparanoia libogg libtheora libvorbis freetype pango liboil gtk which gtkdoc; }; - gstPluginsGood = import ./gst-plugins-good { + gstPluginsGood = makeOverridable (import ./gst-plugins-good) { inherit gstPluginsBase; inherit (args) fetchurl stdenv pkgconfig aalib cairo flac hal libjpeg zlib speex libpng libdv libcaca dbus libiec61883 libavc1394 ladspaH taglib gdbm pulseaudio libsoup; }; - gstFfmpeg = import ./gst-ffmpeg { + gstFfmpeg = makeOverridable (import ./gst-ffmpeg) { inherit fetchurl stdenv pkgconfig gstPluginsBase bzip2; }; - gnonlin = import ./gnonlin { + gnonlin = makeOverridable (import ./gnonlin) { inherit fetchurl stdenv pkgconfig gstreamer gstPluginsBase; }; } diff --git a/pkgs/development/libraries/gstreamer/gst-ffmpeg/default.nix b/pkgs/development/libraries/gstreamer/gst-ffmpeg/default.nix index 0b90ef27abfe..418d9644edca 100644 --- a/pkgs/development/libraries/gstreamer/gst-ffmpeg/default.nix +++ b/pkgs/development/libraries/gstreamer/gst-ffmpeg/default.nix @@ -1,4 +1,4 @@ -{ fetchurl, stdenv, pkgconfig, gstPluginsBase, bzip2 }: +{ fetchurl, stdenv, pkgconfig, gstPluginsBase, bzip2, ... }: stdenv.mkDerivation rec { name = "gst-ffmpeg-0.10.5"; diff --git a/pkgs/development/libraries/gstreamer/gst-plugins-base/default.nix b/pkgs/development/libraries/gstreamer/gst-plugins-base/default.nix index d41039cfd9fa..87815df2209f 100644 --- a/pkgs/development/libraries/gstreamer/gst-plugins-base/default.nix +++ b/pkgs/development/libraries/gstreamer/gst-plugins-base/default.nix @@ -1,7 +1,7 @@ { fetchurl, stdenv, pkgconfig, python, gstreamer , libX11, libXv, libXext, alsaLib, cdparanoia , libogg , libtheora, libvorbis, freetype, pango -, liboil, gtk, which, gtkdoc }: +, liboil, gtk, which, gtkdoc, ... }: stdenv.mkDerivation rec { name = "gst-plugins-base-0.10.22"; diff --git a/pkgs/development/libraries/gstreamer/gst-plugins-good/default.nix b/pkgs/development/libraries/gstreamer/gst-plugins-good/default.nix index e20620aecf1d..690be7115cad 100644 --- a/pkgs/development/libraries/gstreamer/gst-plugins-good/default.nix +++ b/pkgs/development/libraries/gstreamer/gst-plugins-good/default.nix @@ -1,7 +1,7 @@ { fetchurl, stdenv, pkgconfig, gstPluginsBase, aalib, cairo , flac , hal, libjpeg, zlib, speex, libpng, libdv, libcaca, dbus , libiec61883, libavc1394, ladspaH, taglib, gdbm, pulseaudio -, libsoup +, libsoup, ... }: stdenv.mkDerivation rec { diff --git a/pkgs/development/libraries/gstreamer/gstreamer/default.nix b/pkgs/development/libraries/gstreamer/gstreamer/default.nix index 96fdaf81a969..e0c2a5508359 100644 --- a/pkgs/development/libraries/gstreamer/gstreamer/default.nix +++ b/pkgs/development/libraries/gstreamer/gstreamer/default.nix @@ -1,5 +1,5 @@ { fetchurl, stdenv, perl, bison, flex, pkgconfig, python -, which, gtkdoc, glib, libxml2 }: +, which, gtkdoc, glib, libxml2, ... }: stdenv.mkDerivation rec { name = "gstreamer-0.10.22"; diff --git a/pkgs/development/libraries/libjpeg/default.nix b/pkgs/development/libraries/libjpeg/default.nix index b23c6fabf7b2..fb92fe995b66 100644 --- a/pkgs/development/libraries/libjpeg/default.nix +++ b/pkgs/development/libraries/libjpeg/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, libtool, static ? false}: +{stdenv, fetchurl, libtool, static ? false, ...}: stdenv.mkDerivation { name = "libjpeg-6b"; diff --git a/pkgs/development/libraries/liboil/default.nix b/pkgs/development/libraries/liboil/default.nix index 1bfbb6bbff27..1e253ad78427 100644 --- a/pkgs/development/libraries/liboil/default.nix +++ b/pkgs/development/libraries/liboil/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, pkgconfig, glib}: +{stdenv, fetchurl, pkgconfig, glib, ...}: stdenv.mkDerivation rec { name = "liboil-0.3.15"; diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix index 287088f616e7..d1b151a3fee2 100644 --- a/pkgs/development/libraries/libxml2/default.nix +++ b/pkgs/development/libraries/libxml2/default.nix @@ -1,4 +1,4 @@ -{stdenv, fetchurl, zlib, python ? null, pythonSupport ? true}: +{stdenv, fetchurl, zlib, python ? null, pythonSupport ? true, ...}: assert pythonSupport -> python != null; diff --git a/pkgs/development/libraries/policykit/default.nix b/pkgs/development/libraries/policykit/default.nix index 2aa7fdf29eb9..90ab6fb45bbd 100644 --- a/pkgs/development/libraries/policykit/default.nix +++ b/pkgs/development/libraries/policykit/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, pkgconfig, glib, dbus, dbus_glib, expat, pam -, intltool, gettext, libxslt, docbook_xsl }: +, intltool, gettext, libxslt, docbook_xsl, ... }: stdenv.mkDerivation rec { name = "policykit-0.9"; diff --git a/pkgs/os-specific/linux/udev/default.nix b/pkgs/os-specific/linux/udev/default.nix index 21b9ce46eb97..988d0a3df3b9 100644 --- a/pkgs/os-specific/linux/udev/default.nix +++ b/pkgs/os-specific/linux/udev/default.nix @@ -1,4 +1,5 @@ -{stdenv, fetchurl, gperf, pkgconfig, glib, acl, libusb, usbutils, pciutils}: +{stdenv, fetchurl, gperf, pkgconfig, glib, acl, + libusb, usbutils, pciutils, ...}: assert stdenv ? glibc; diff --git a/pkgs/os-specific/linux/util-linux-ng/default.nix b/pkgs/os-specific/linux/util-linux-ng/default.nix index 4f916a4154bb..e70f2dfcb07b 100644 --- a/pkgs/os-specific/linux/util-linux-ng/default.nix +++ b/pkgs/os-specific/linux/util-linux-ng/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, ncurses ? null }: +{ stdenv, fetchurl, ncurses ? null, ... }: stdenv.mkDerivation rec { name = "util-linux-ng-2.16"; diff --git a/pkgs/servers/pulseaudio/default.nix b/pkgs/servers/pulseaudio/default.nix index 73e63bebdc03..5f770c9cf7c9 100644 --- a/pkgs/servers/pulseaudio/default.nix +++ b/pkgs/servers/pulseaudio/default.nix @@ -1,6 +1,6 @@ { stdenv, fetchurl, pkgconfig, gnum4, gdbm, libtool, glib, dbus, hal, avahi , gconf, liboil, libX11, libICE, libSM, intltool, gettext, alsaLib -, libsamplerate, libsndfile, speex }: +, libsamplerate, libsndfile, speex, ... }: stdenv.mkDerivation rec { name = "pulseaudio-0.9.13"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 26e60aa3a859..7c4aeb02d564 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -191,9 +191,16 @@ let # let d = makeOverridable stdenv.mkDerivation { name = ..; buildInputs; } # noBuildInputs = d.override { buildInputs = []; } # additionalBuildInputs = d.override ( args : args // { buildInputs = args.buildInputs ++ [ additional ]; } ) + deepOverride = newArgs: name: x: if builtins.isAttrs x then ( + if x ? deepOverride then (x.deepOverride newArgs) else + if x ? override then (x.override newArgs) else + x) else x; makeOverridable = f: origArgs: f origArgs // { override = newArgs: makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs)); + deepOverride = newArgs: + makeOverridable f ((lib.mapAttrs (deepOverride newArgs) origArgs) // newArgs); + origArgs = origArgs; }; @@ -439,7 +446,7 @@ let avahi = let qt4Support = getConfig [ "avahi" "qt4Support" ] false; in - import ../development/libraries/avahi { + makeOverridable (import ../development/libraries/avahi) { inherit stdenv fetchurl pkgconfig libdaemon dbus perl perlXMLParser expat gettext intltool lib; inherit (gtkLibs) glib gtk; @@ -3058,7 +3065,9 @@ let inherit stdenv fetchurl lib; }; - consolekit = import ../development/libraries/consolekit { + consolekit = makeOverridable + (import ../development/libraries/consolekit) + { inherit stdenv fetchurl pkgconfig dbus_glib zlib pam policykit expat; inherit (gtkLibs) glib; inherit (xlibs) libX11; @@ -3111,16 +3120,13 @@ let useX11 = true; # !!! `false' doesn't build }; - dbus_glib = import ../development/libraries/dbus-glib { + dbus_glib = makeOverridable + (import ../development/libraries/dbus-glib) + { inherit fetchurl stdenv pkgconfig gettext dbus expat; inherit (gtkLibs) glib; }; - dbus_glib_gtk_218 = import ../development/libraries/dbus-glib { - inherit fetchurl stdenv pkgconfig gettext dbus expat; - inherit (gtkLibs218) glib; - }; - dclib = import ../development/libraries/dclib { inherit fetchurl stdenv libxml2 openssl bzip2; }; @@ -3129,7 +3135,9 @@ let inherit fetchurl stdenv perl; }; - enchant = selectVersion ../development/libraries/enchant "1.3.0" { + enchant = makeOverridable + (selectVersion ../development/libraries/enchant "1.3.0") + { inherit fetchurl stdenv aspell pkgconfig; inherit (gnome) glib; }; @@ -3393,7 +3401,7 @@ let inherit lib selectVersion stdenv fetchurl perl bison pkgconfig libxml2 python alsaLib cdparanoia libogg libvorbis libtheora freetype liboil libjpeg zlib speex libpng libdv aalib cairo libcaca flac hal libiec61883 - dbus libavc1394 ladspaH taglib pulseaudio gdbm bzip2 which; + dbus libavc1394 ladspaH taglib pulseaudio gdbm bzip2 which makeOverridable; flex = flex2535; inherit (xorg) libX11 libXv libXext; inherit (gtkLibs) glib pango gtk; @@ -3402,18 +3410,6 @@ let libsoup = gnome26.libsoup; }); - gst_all_gtk_218 = recurseIntoAttrs (import ../development/libraries/gstreamer { - inherit lib selectVersion stdenv fetchurl perl bison pkgconfig libxml2 - python alsaLib cdparanoia libogg libvorbis libtheora freetype liboil - libjpeg zlib speex libpng libdv aalib cairo libcaca flac hal libiec61883 - dbus libavc1394 ladspaH taglib pulseaudio gdbm bzip2 which; - flex = flex2535; - inherit (xorg) libX11 libXv libXext; - inherit (gtkLibs218) glib pango gtk; - inherit (gnome28) gnomevfs /* <- only passed for the no longer used older versions - it is deprecated and didn't build on amd64 due to samba dependency */ gtkdoc libsoup; - }); - gnet = import ../development/libraries/gnet { inherit fetchurl stdenv pkgconfig; inherit (gtkLibs) glib; @@ -3832,7 +3828,9 @@ let inherit fetchurl stdenv; }; - liboil = import ../development/libraries/liboil { + liboil = makeOverridable + (import ../development/libraries/liboil) + { inherit fetchurl stdenv pkgconfig; inherit (gtkLibs) glib; }; @@ -4174,7 +4172,7 @@ let inherit (gtkLibs) glib; }; - policykit = import ../development/libraries/policykit { + policykit = makeOverridable (import ../development/libraries/policykit) { inherit stdenv fetchurl pkgconfig dbus dbus_glib expat pam intltool gettext libxslt docbook_xsl; inherit (gtkLibs) glib; @@ -4407,18 +4405,26 @@ let inherit fetchurl stdenv cmake unzip libtiff expat zlib libpng libjpeg; }; - webkit = builderDefsPackage (import ../development/libraries/webkit) { + webkit = builderDefsPackage (import ../development/libraries/webkit) + (lib.mapAttrs (deepOverride + { + # It needs fresh GTK + inherit (gnome28) gtkdoc libsoup GConf; + inherit (gtkLibs218) gtk atk pango glib; + gconf = gnome28.GConf; + }) + { inherit (gnome28) gtkdoc libsoup; - inherit (gtkLibs218) gtk atk pango; + inherit (gtkLibs218) gtk atk pango glib; inherit freetype fontconfig gettext gperf curl libjpeg libtiff libpng libxml2 libxslt sqlite icu cairo perl intltool automake libtool pkgconfig autoconf bison libproxy enchant; - inherit (gst_all_gtk_218) gstreamer gstPluginsBase gstFfmpeg + inherit (gst_all) gstreamer gstPluginsBase gstFfmpeg gstPluginsGood; flex = flex2535; inherit (xlibs) libXt; - }; + }); wxGTK = wxGTK26; @@ -4856,7 +4862,7 @@ let inherit fetchurl stdenv db4 openssl cyrus_sasl glibc; }; - pulseaudio = import ../servers/pulseaudio { + pulseaudio = makeOverridable (import ../servers/pulseaudio) { inherit fetchurl stdenv pkgconfig gnum4 gdbm dbus hal avahi liboil libsamplerate libsndfile speex intltool gettext; @@ -5144,7 +5150,7 @@ let flex = flex2535; }; - hal = import ../os-specific/linux/hal { + hal = makeOverridable (import ../os-specific/linux/hal) { inherit fetchurl stdenv pkgconfig python pciutils usbutils expat libusb dbus dbus_glib libuuid perl perlXMLParser gettext zlib eject libsmbios udev gperf dmidecode utillinuxng @@ -5993,7 +5999,7 @@ let inherit (xlibs) libX11 xproto; };*/ - udev = import ../os-specific/linux/udev { + udev = makeOverridable (import ../os-specific/linux/udev) { inherit fetchurl stdenv gperf pkgconfig acl libusb usbutils pciutils; inherit (gtkLibs) glib; }; @@ -8137,7 +8143,15 @@ let gnome28 = import ../desktops/gnome-2.28 (pkgs// { gtkLibs = gtkLibs218; - dbus_glib = dbus_glib_gtk_218; + dbus_glib = dbus_glib.override { + inherit (gtkLibs218) glib; + }; + policykit = policykit.deepOverride { + inherit (gtkLibs218) glib; + }; + hal = hal.deepOverride { + inherit (gtkLibs218) glib; + }; }); kde3 = {