From e6077fbc46561fbe85c40a43b2b0e86e939f984f Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 19 Sep 2012 13:56:56 -0400 Subject: [PATCH] Remove getConfig helper function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An expression like ‘getConfig [ "cabal" "libraryProfiling" ] false’ can be written more concisely as ‘config.cabal.libraryProfiling or false’. --- .../applications/editors/vim/configurable.nix | 14 +- pkgs/applications/misc/grass/default.nix | 52 +++--- .../networking/browsers/chromium/default.nix | 87 +++++----- pkgs/build-support/source-from-head-fun.nix | 6 +- pkgs/development/interpreters/octave/hg.nix | 8 +- pkgs/development/interpreters/php/5.2.nix | 34 ++-- pkgs/development/interpreters/php/5.3.nix | 34 ++-- pkgs/development/interpreters/ruby/libs.nix | 4 +- pkgs/games/oilrush/default.nix | 7 +- pkgs/top-level/all-packages.nix | 158 +++++++++--------- pkgs/top-level/haskell-defaults.nix | 6 +- 11 files changed, 203 insertions(+), 207 deletions(-) diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix index 7e03fd6b7b30..9e6b700f9efa 100644 --- a/pkgs/applications/editors/vim/configurable.nix +++ b/pkgs/applications/editors/vim/configurable.nix @@ -46,14 +46,14 @@ composableDerivation {} { ; cfg = { - pythonSupport = getConfig [ "vim" "python" ] true; - darwinSupport = getConfig [ "vim" "darwin" ] false; - nlsSupport = getConfig [ "vim" "nls" ] false; - tclSupport = getConfig [ "vim" "tcl" ] false; - multibyteSupport = getConfig [ "vim" "multibyte" ] false; - cscopeSupport = getConfig [ "vim" "cscope" ] false; + pythonSupport = config.vim.python or true; + darwinSupport = config.vim.darwin or false; + nlsSupport = config.vim.nls or false; + tclSupport = config.vim.tcl or false; + multibyteSupport = config.vim.multibyte or false; + cscopeSupport = config.vim.cscope or false; # add .nix filetype detection and minimal syntax highlighting support - ftNixSupport = getConfig [ "vim" "ftNix" ] true; + ftNixSupport = config.vim.ftNix or true; }; #--enable-gui=OPTS X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon diff --git a/pkgs/applications/misc/grass/default.nix b/pkgs/applications/misc/grass/default.nix index 067e43545737..6abf6da4a69f 100644 --- a/pkgs/applications/misc/grass/default.nix +++ b/pkgs/applications/misc/grass/default.nix @@ -1,4 +1,4 @@ -{getConfig, ...}@a: +{ config, ... }@a: # You can set gui by exporting GRASS_GUI=.. # see http://grass.itc.it/gdp/html_grass64/g.gui.html @@ -36,31 +36,31 @@ a.composableDerivation.composableDerivation {} (fix: { ]; cfg = { - _64bitSupport = getConfig ["grass" "64bitSupport"] true; - cursesSupport = getConfig ["grass" "curses"] true; - gdalSupport = getConfig ["grass" "gdal"] true; - pythonSupport = getConfig ["grass" "python"] true; - wxwidgetsSupport = getConfig ["grass" "wxwidgets"] true; - readlineSupport = getConfig ["grass" "readline"] true; - jpegSupport = getConfig ["grass" "jpeg"] true; - tiffSupport = getConfig ["grass" "tiff"] true; - pngSupport = getConfig ["grass" "png"] true; - tcltkSupport = getConfig ["grass" "tcltk"] true; - postgresSupport = getConfig ["grass" "postgres"] true; - mysqlSupport = getConfig ["grass" "mysql"] true; - sqliteSupport = getConfig ["grass" "sqlite"] true; - ffmpegSupport = getConfig ["grass" "ffmpeg"] true; - openglSupport = getConfig ["grass" "opengl"] true; - odbcSupport = getConfig ["grass" "odbc"] false; # fails to find libodbc - why ? - fftwSupport = getConfig ["grass" "fftw"] true; - blasSupport = getConfig ["grass" "blas"] true; - lapackSupport = getConfig ["grass" "lapack"] true; - cairoSupport = getConfig ["grass" "cairo"] true; - motifSupport = getConfig ["grass" "motif"] true; - freetypeSupport = getConfig ["grass" "freetype"] true; - projSupport = getConfig ["grass" "proj"] true; - opendwgSupport = getConfig ["grass" "dwg"] false; - largefileSupport = getConfig ["grass" "largefile"] true; + _64bitSupport = config.grass."64bitSupport" or true; + cursesSupport = config.grass.curses or true; + gdalSupport = config.grass.gdal or true; + pythonSupport = config.grass.python or true; + wxwidgetsSupport = config.grass.wxwidgets or true; + readlineSupport = config.grass.readline or true; + jpegSupport = config.grass.jpeg or true; + tiffSupport = config.grass.tiff or true; + pngSupport = config.grass.png or true; + tcltkSupport = config.grass.tcltk or true; + postgresSupport = config.grass.postgres or true; + mysqlSupport = config.grass.mysql or true; + sqliteSupport = config.grass.sqlite or true; + ffmpegSupport = config.grass.ffmpeg or true; + openglSupport = config.grass.opengl or true; + odbcSupport = config.grass.odbc or false; # fails to find libodbc - why ? + fftwSupport = config.grass.fftw or true; + blasSupport = config.grass.blas or true; + lapackSupport = config.grass.lapack or true; + cairoSupport = config.grass.cairo or true; + motifSupport = config.grass.motif or true; + freetypeSupport = config.grass.freetype or true; + projSupport = config.grass.proj or true; + opendwgSupport = config.grass.dwg or false; + largefileSupport = config.grass.largefile or true; }; # ?? NLS support: no diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix index 7a3c387dedad..33f9283b47ad 100644 --- a/pkgs/applications/networking/browsers/chromium/default.nix +++ b/pkgs/applications/networking/browsers/chromium/default.nix @@ -1,4 +1,4 @@ -{ stdenv, getConfig, fetchurl, makeWrapper, which +{ stdenv, config, fetchurl, makeWrapper, which # default dependencies , bzip2, flac, speex @@ -22,10 +22,12 @@ , libselinux # config.selinux }: -let - mkConfigurable = stdenv.lib.mapAttrs (flag: default: getConfig ["chromium" flag] default); +with stdenv.lib; - config = mkConfigurable { +let + mkConfigurable = mapAttrs (flag: default: attrByPath ["chromium" flag] default config); + + cfg = mkConfigurable { channel = "stable"; selinux = false; nacl = false; @@ -34,18 +36,19 @@ let gnomeKeyring = false; proprietaryCodecs = true; cups = false; - pulseaudio = getConfig ["pulseaudio"] true; + pulseaudio = config.pulseaudio or true; }; - sourceInfo = builtins.getAttr config.channel (import ./sources.nix); + sourceInfo = builtins.getAttr cfg.channel (import ./sources.nix); - mkGypFlags = with stdenv.lib; let - sanitize = value: - if value == true then "1" - else if value == false then "0" - else "${value}"; - toFlag = key: value: "-D${key}=${sanitize value}"; - in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); + mkGypFlags = + let + sanitize = value: + if value == true then "1" + else if value == false then "0" + else "${value}"; + toFlag = key: value: "-D${key}=${sanitize value}"; + in attrs: concatStringsSep " " (attrValues (mapAttrs toFlag attrs)); gypFlagsUseSystemLibs = { use_system_bzip2 = true; @@ -56,7 +59,7 @@ let use_system_libpng = true; use_system_libxml = true; use_system_speex = true; - use_system_ssl = config.openssl; + use_system_ssl = cfg.openssl; use_system_stlport = true; use_system_xdg_utils = true; use_system_yasm = true; @@ -78,12 +81,12 @@ let ]; seccompPatch = let - pre22 = stdenv.lib.versionOlder sourceInfo.version "22.0.0.0"; + pre22 = versionOlder sourceInfo.version "22.0.0.0"; in if pre22 then ./enable_seccomp.patch else ./enable_seccomp22.patch; # XXX: this reverts r151720 to prevent http://crbug.com/143623 maybeRevertZlibChanges = let - below22 = stdenv.lib.versionOlder sourceInfo.version "22.0.0.0"; + below22 = versionOlder sourceInfo.version "22.0.0.0"; patch = fetchurl { name = "revert-r151720"; url = "http://git.chromium.org/gitweb/?p=chromium.git;a=commitdiff_plain;" @@ -91,7 +94,7 @@ let + "h=0fabb4fda7059a8757422e8a44e70deeab28e698"; sha256 = "0n0d6mkg89g8q63cifapzpg9dxfs2n6xvk4k13szhymvf67b77pf"; }; - in stdenv.lib.optional (!below22) patch; + in optional (!below22) patch; in stdenv.mkDerivation rec { name = "${packageName}-${version}"; @@ -108,28 +111,28 @@ in stdenv.mkDerivation rec { which makeWrapper python perl pkgconfig nspr udev - (if config.openssl then openssl else nss) + (if cfg.openssl then openssl else nss) utillinux alsaLib gcc bison gperf krb5 glib gtk dbus_glib libXScrnSaver libXcursor mesa - ] ++ stdenv.lib.optional config.gnomeKeyring libgnome_keyring - ++ stdenv.lib.optionals config.gnome [ gconf libgcrypt ] - ++ stdenv.lib.optional config.selinux libselinux - ++ stdenv.lib.optional config.cups libgcrypt - ++ stdenv.lib.optional config.pulseaudio pulseaudio; + ] ++ optional cfg.gnomeKeyring libgnome_keyring + ++ optionals cfg.gnome [ gconf libgcrypt ] + ++ optional cfg.selinux libselinux + ++ optional cfg.cups libgcrypt + ++ optional cfg.pulseaudio pulseaudio; - opensslPatches = stdenv.lib.optional config.openssl openssl.patches; + opensslPatches = optional cfg.openssl openssl.patches; prePatch = "patchShebangs ."; - patches = stdenv.lib.optional (!config.selinux) seccompPatch - ++ stdenv.lib.optional config.cups ./cups_allow_deprecated.patch - ++ stdenv.lib.optional config.pulseaudio ./pulseaudio_array_bounds.patch + patches = optional (!cfg.selinux) seccompPatch + ++ optional cfg.cups ./cups_allow_deprecated.patch + ++ optional cfg.pulseaudio ./pulseaudio_array_bounds.patch ++ maybeRevertZlibChanges; - postPatch = stdenv.lib.optionalString config.openssl '' + postPatch = optionalString cfg.openssl '' cat $opensslPatches | patch -p1 -d third_party/openssl/openssl ''; @@ -137,21 +140,21 @@ in stdenv.mkDerivation rec { linux_use_gold_binary = false; linux_use_gold_flags = false; proprietary_codecs = false; - use_gnome_keyring = config.gnomeKeyring; - use_gconf = config.gnome; - use_gio = config.gnome; - use_pulseaudio = config.pulseaudio; - disable_nacl = !config.nacl; - use_openssl = config.openssl; - selinux = config.selinux; - use_cups = config.cups; - } // stdenv.lib.optionalAttrs config.proprietaryCodecs { + use_gnome_keyring = cfg.gnomeKeyring; + use_gconf = cfg.gnome; + use_gio = cfg.gnome; + use_pulseaudio = cfg.pulseaudio; + disable_nacl = !cfg.nacl; + use_openssl = cfg.openssl; + selinux = cfg.selinux; + use_cups = cfg.cups; + } // optionalAttrs cfg.proprietaryCodecs { # enable support for the H.264 codec proprietary_codecs = true; ffmpeg_branding = "Chrome"; - } // stdenv.lib.optionalAttrs (stdenv.system == "x86_64-linux") { + } // optionalAttrs (stdenv.system == "x86_64-linux") { target_arch = "x64"; - } // stdenv.lib.optionalAttrs (stdenv.system == "i686-linux") { + } // optionalAttrs (stdenv.system == "i686-linux") { target_arch = "ia32"; }); @@ -203,11 +206,11 @@ in stdenv.mkDerivation rec { done ''; - meta = with stdenv.lib; { + meta = { description = "Chromium, an open source web browser"; homepage = http://www.chromium.org/; - maintainers = with stdenv.lib.maintainers; [ goibhniu chaoflow ]; + maintainers = with maintainers; [ goibhniu chaoflow ]; license = licenses.bsd3; - platforms = with stdenv.lib.platforms; linux; + platforms = platforms.linux; }; } diff --git a/pkgs/build-support/source-from-head-fun.nix b/pkgs/build-support/source-from-head-fun.nix index 3281cec54440..c6d6cfcc95b6 100644 --- a/pkgs/build-support/source-from-head-fun.nix +++ b/pkgs/build-support/source-from-head-fun.nix @@ -9,8 +9,8 @@ The documentation is availible at http://github.com/MarcWeber/nix-repository-manager/raw/master/README */ -{ getConfig }: +{ config }: localTarName: publishedSrcSnapshot: - if getConfig ["sourceFromHead" "useLocalRepos"] false then - "${getConfig ["sourceFromHead" "managedRepoDir"] "/set/sourceFromHead.managedRepoDir/please"}/dist/${localTarName}" + if config.sourceFromHead.useLocalRepos or false then + "${config.sourceFromHead.managedRepoDir or "/set/sourceFromHead.managedRepoDir/please"}/dist/${localTarName}" else publishedSrcSnapshot diff --git a/pkgs/development/interpreters/octave/hg.nix b/pkgs/development/interpreters/octave/hg.nix index a908ddc0fc88..f414dd719654 100644 --- a/pkgs/development/interpreters/octave/hg.nix +++ b/pkgs/development/interpreters/octave/hg.nix @@ -1,5 +1,5 @@ {stdenv, fetchurl, gfortran, readline, ncurses, perl, flex, - bison, autoconf, automake, sourceFromHead, getConfig, lib, atlas, gperf, python, glibc, gnuplot, texinfo, texLive, qhull, libX11}: + bison, autoconf, automake, sourceFromHead, config, lib, atlas, gperf, python, glibc, gnuplot, texinfo, texLive, qhull, libX11}: let commonBuildInputs = [gfortran readline ncurses perl glibc qhull libX11 texinfo]; in @@ -12,7 +12,7 @@ stdenv.mkDerivation ({ license = "GPL-3"; }; } // ( - if (getConfig ["octave" "devVersion"] false) then { + if (config.octave.devVersion or false) then { name = "octave-hg"; # developement version mercurial repo # REGION AUTO UPDATE: { name="octave"; type = "hg"; url = "http://www.octave.org/hg/octave"; } src = sourceFromHead "octave-03b414516dd8.tar.gz" @@ -27,7 +27,7 @@ stdenv.mkDerivation ({ export HOME=$TMP ''; buildInputs = commonBuildInputs ++ [ flex bison autoconf automake gperf gnuplot texLive ] - ++ lib.optionals (getConfig ["octave" "atlas"] true) [ python atlas ]; + ++ lib.optionals (config.octave.atlas or true) [ python atlas ]; # it does build, but documentation doesn't.. So just remove that directory # from the buildfile buildPhase = '' @@ -44,6 +44,6 @@ stdenv.mkDerivation ({ sha256 = "1lm4v85kdic4n5yxwzrdb0v6dc6nw06ljgx1q8hfkmi146kpg7s6"; }; buildInputs = commonBuildInputs ++ [ flex bison autoconf automake python ] - ++ lib.optionals (getConfig ["octave" "atlas"] true) [ python atlas ]; + ++ lib.optionals (config.octave.atlas or true) [ python atlas ]; } )) diff --git a/pkgs/development/interpreters/php/5.2.nix b/pkgs/development/interpreters/php/5.2.nix index f98d178663f1..4395c0f498c9 100644 --- a/pkgs/development/interpreters/php/5.2.nix +++ b/pkgs/development/interpreters/php/5.2.nix @@ -121,23 +121,23 @@ composableDerivation {} ( fixed : let inherit (fixed.fixed) version; in { }; cfg = { - mysqlSupport = getConfig ["php" "mysql"] true; - mysqliSupport = getConfig ["php" "mysqli"] true; - pdo_mysqlSupport = getConfig ["php" "pdo_mysql"] true; - libxml2Support = getConfig ["php" "libxml2"] true; - apxs2Support = getConfig ["php" "apxs2"] true; - bcmathSupport = getConfig ["php" "bcmath"] true; - socketsSupport = getConfig ["php" "sockets"] true; - curlSupport = getConfig ["php" "curl"] true; - gettextSupport = getConfig ["php" "gettext"] true; - postgresqlSupport = getConfig ["php" "postgresql"] true; - readlineSupport = getConfig ["php" "readline"] true; - sqliteSupport = getConfig ["php" "sqlite"] true; - soapSupport = getConfig ["php" "soap"] true; - zlibSupport = getConfig ["php" "zlib"] true; - opensslSupport = getConfig ["php" "openssl"] true; - mbstringSupport = getConfig ["php" "mbstring"] true; - gdSupport = getConfig ["php" "gd"] true; + mysqlSupport = config.php.mysql or true; + mysqliSupport = config.php.mysqli or true; + pdo_mysqlSupport = config.php.pdo_mysql or true; + libxml2Support = config.php.libxml2 or true; + apxs2Support = config.php.apxs2 or true; + bcmathSupport = config.php.bcmath or true; + socketsSupport = config.php.sockets or true; + curlSupport = config.php.curl or true; + gettextSupport = config.php.gettext or true; + postgresqlSupport = config.php.postgresql or true; + readlineSupport = config.php.readline or true; + sqliteSupport = config.php.sqlite or true; + soapSupport = config.php.soap or true; + zlibSupport = config.php.zlib or true; + opensslSupport = config.php.openssl or true; + mbstringSupport = config.php.mbstring or true; + gdSupport = config.php.gd or true; }; configurePhase = '' diff --git a/pkgs/development/interpreters/php/5.3.nix b/pkgs/development/interpreters/php/5.3.nix index b4f00ab1f7d4..d4aebc77637b 100644 --- a/pkgs/development/interpreters/php/5.3.nix +++ b/pkgs/development/interpreters/php/5.3.nix @@ -121,23 +121,23 @@ composableDerivation {} ( fixed : let inherit (fixed.fixed) version; in { }; cfg = { - mysqlSupport = getConfig ["php" "mysql"] true; - mysqliSupport = getConfig ["php" "mysqli"] true; - pdo_mysqlSupport = getConfig ["php" "pdo_mysql"] true; - libxml2Support = getConfig ["php" "libxml2"] true; - apxs2Support = getConfig ["php" "apxs2"] true; - bcmathSupport = getConfig ["php" "bcmath"] true; - socketsSupport = getConfig ["php" "sockets"] true; - curlSupport = getConfig ["php" "curl"] true; - gettextSupport = getConfig ["php" "gettext"] true; - postgresqlSupport = getConfig ["php" "postgresql"] true; - readlineSupport = getConfig ["php" "readline"] true; - sqliteSupport = getConfig ["php" "sqlite"] true; - soapSupport = getConfig ["php" "soap"] true; - zlibSupport = getConfig ["php" "zlib"] true; - opensslSupport = getConfig ["php" "openssl"] true; - mbstringSupport = getConfig ["php" "mbstring"] true; - gdSupport = getConfig ["php" "gd"] true; + mysqlSupport = config.php.mysql or true; + mysqliSupport = config.php.mysqli or true; + pdo_mysqlSupport = config.php.pdo_mysql or true; + libxml2Support = config.php.libxml2 or true; + apxs2Support = config.php.apxs2 or true; + bcmathSupport = config.php.bcmath or true; + socketsSupport = config.php.sockets or true; + curlSupport = config.php.curl or true; + gettextSupport = config.php.gettext or true; + postgresqlSupport = config.php.postgresql or true; + readlineSupport = config.php.readline or true; + sqliteSupport = config.php.sqlite or true; + soapSupport = config.php.soap or true; + zlibSupport = config.php.zlib or true; + opensslSupport = config.php.openssl or true; + mbstringSupport = config.php.mbstring or true; + gdSupport = config.php.gd or true; }; configurePhase = '' diff --git a/pkgs/development/interpreters/ruby/libs.nix b/pkgs/development/interpreters/ruby/libs.nix index 9aa9203f10f6..1b4b7aec2b1c 100644 --- a/pkgs/development/interpreters/ruby/libs.nix +++ b/pkgs/development/interpreters/ruby/libs.nix @@ -1,4 +1,4 @@ -{stdenv, getConfig, fetchurl, callPackage}: +{ stdenv, config, fetchurl, callPackage }: let inherit (stdenv.lib) fold optional; @@ -36,7 +36,7 @@ in if builtins.pathExists file then import (builtins.toPath file) else null; in - getConfig [ "gems" name ] fallback; + stdenv.lib.attrByPath [ "gems" name ] fallback config; in { generated = getLocalGemFun "generated"; diff --git a/pkgs/games/oilrush/default.nix b/pkgs/games/oilrush/default.nix index 4605f04e3ae5..339c3bbd1a84 100644 --- a/pkgs/games/oilrush/default.nix +++ b/pkgs/games/oilrush/default.nix @@ -1,11 +1,12 @@ -{ stdenv, getConfig, fetchurl, libX11, libXext, libXinerama, libXrandr +{ stdenv, config, fetchurl, libX11, libXext, libXinerama, libXrandr , libXrender, fontconfig, freetype, openal }: + stdenv.mkDerivation { name = "oilrush"; src = let - url = getConfig [ "oilrush" "url" ] null; - sha256 = getConfig [ "oilrush" "sha256" ] null; + url = config.oilrush.url or null; + sha256 = config.oilrush.sha256 or null; in assert url != null && sha256 != null; fetchurl { inherit url sha256; }; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9649152d7af2..0d44816448eb 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -78,11 +78,7 @@ let # Allow setting the platform in the config file. Otherwise, let's use a reasonable default (pc) platform = if platform_ != null then platform_ - else getConfig [ "platform" ] (import ./platforms.nix).pc; - - # Return an attribute from the Nixpkgs configuration file, or - # a default value if the attribute doesn't exist. - getConfig = attrPath: default: lib.attrByPath attrPath default config; + else config.platform or (import ./platforms.nix).pc; # Helper functions that are exported through `pkgs'. @@ -101,7 +97,7 @@ let # (un-overriden) set of packages, allowing packageOverrides # attributes to refer to the original attributes (e.g. "foo = # ... pkgs.foo ..."). - pkgs = applyGlobalOverrides (getConfig ["packageOverrides"] (pkgs: {})); + pkgs = applyGlobalOverrides (config.packageOverrides or (pkgs: {})); # Return the complete set of packages, after applying the overrides @@ -178,7 +174,7 @@ let ### Helper functions. - inherit lib config getConfig stdenvAdapters; + inherit lib config stdenvAdapters; inherit (lib) lowPrio hiPrio appendToName makeOverridable; @@ -214,7 +210,7 @@ let stdenvCross else let - changer = getConfig ["replaceStdenv"] null; + changer = config.replaceStdenv or null; in if changer != null then changer { # We import again all-packages to avoid recursivities. @@ -277,7 +273,7 @@ let fetchgitrevision = import ../build-support/fetchgitrevision runCommand git; - fetchmtn = callPackage ../build-support/fetchmtn (getConfig ["fetchmtn"] {}); + fetchmtn = callPackage ../build-support/fetchmtn (config.fetchmtn or {}); fetchsvn = import ../build-support/fetchsvn { inherit stdenv subversion openssh; @@ -417,7 +413,7 @@ let autojump = callPackage ../tools/misc/autojump { }; avahi = callPackage ../development/libraries/avahi { - qt4Support = getConfig [ "avahi" "qt4Support" ] false; + qt4Support = config.avahi.qt4Support or false; }; aws = callPackage ../tools/virtualization/aws { }; @@ -837,7 +833,7 @@ let }; grub = callPackage_i686 ../tools/misc/grub { - buggyBiosCDSupport = getConfig ["grub" "buggyBiosCDSupport"] true; + buggyBiosCDSupport = config.grub.buggyBiosCDSupport or true; }; grub2 = callPackage ../tools/misc/grub/2.0x.nix { }; @@ -1635,7 +1631,7 @@ let }; truecrypt = callPackage ../applications/misc/truecrypt { - wxGUI = getConfig [ "truecrypt" "wxGUI" ] true; + wxGUI = config.truecrypt.wxGUI or true; }; ttmkfdir = callPackage ../tools/misc/ttmkfdir { }; @@ -2744,14 +2740,14 @@ let inherit stdenv fetchurl lib composableDerivation autoconf automake flex bison apacheHttpd mysql libxml2 readline - zlib curl gd postgresql openssl pkgconfig sqlite getConfig libiconv libjpeg libpng; + zlib curl gd postgresql openssl pkgconfig sqlite config libiconv libjpeg libpng; }; php5_3 = makeOverridable (import ../development/interpreters/php/5.3.nix) { inherit stdenv fetchurl lib composableDerivation autoconf automake flex bison apacheHttpd mysql libxml2 readline - zlib curl gd postgresql openssl pkgconfig sqlite getConfig libiconv libjpeg libpng; + zlib curl gd postgresql openssl pkgconfig sqlite config libiconv libjpeg libpng; }; php_apc = callPackage ../development/libraries/php-apc { }; @@ -2821,7 +2817,7 @@ let rubySqlite3 = callPackage ../development/ruby-modules/sqlite3 { }; rLang = callPackage ../development/interpreters/r-lang { - withBioconductor = getConfig ["rLang" "withBioconductor"] false; + withBioconductor = config.rLang.withBioconductor or false; }; rubygemsFun = ruby: builderDefsPackage (import ../development/interpreters/ruby/rubygems.nix) { @@ -2859,7 +2855,7 @@ let */ sourceFromHead = import ../build-support/source-from-head-fun.nix { - inherit getConfig; + inherit config; }; ecj = callPackage ../development/eclipse/ecj { }; @@ -3175,10 +3171,10 @@ let radare = callPackage ../development/tools/analysis/radare { inherit (gnome) vte; lua = lua5; - useX11 = getConfig ["radare" "useX11"] false; - pythonBindings = getConfig ["radare" "pythonBindings"] false; - rubyBindings = getConfig ["radare" "rubyBindings"] false; - luaBindings = getConfig ["radare" "luaBindings"] false; + useX11 = config.radare.useX11 or false; + pythonBindings = config.radare.pythonBindings or false; + rubyBindings = config.radare.rubyBindings or false; + luaBindings = config.radare.luaBindings or false; }; ragel = callPackage ../development/tools/parsing/ragel { }; @@ -3610,19 +3606,19 @@ let glibc29 = callPackage ../development/libraries/glibc/2.9 { kernelHeaders = linuxHeaders; - installLocales = getConfig [ "glibc" "locales" ] false; + installLocales = config.glibc.locales or false; }; glibc29Cross = forceBuildDrv (makeOverridable (import ../development/libraries/glibc/2.9) { inherit stdenv fetchurl; gccCross = gccCrossStageStatic; kernelHeaders = linuxHeadersCross; - installLocales = getConfig [ "glibc" "locales" ] false; + installLocales = config.glibc.locales or false; }); glibc213 = (callPackage ../development/libraries/glibc/2.13 { kernelHeaders = linuxHeaders; - installLocales = getConfig [ "glibc" "locales" ] false; + installLocales = config.glibc.locales or false; machHeaders = null; hurdHeaders = null; gccCross = null; @@ -3634,7 +3630,7 @@ let inherit stdenv fetchurl; gccCross = gccCrossStageStatic; kernelHeaders = if crossGNU then gnu.hurdHeaders else linuxHeadersCross; - installLocales = getConfig [ "glibc" "locales" ] false; + installLocales = config.glibc.locales or false; } // lib.optionalAttrs crossGNU { inherit (gnu) machHeaders hurdHeaders libpthreadHeaders mig; @@ -3643,7 +3639,7 @@ let glibc214 = (callPackage ../development/libraries/glibc/2.14 { kernelHeaders = linuxHeaders; - installLocales = getConfig [ "glibc" "locales" ] false; + installLocales = config.glibc.locales or false; machHeaders = null; hurdHeaders = null; gccCross = null; @@ -3655,7 +3651,7 @@ let inherit stdenv fetchurl; gccCross = gccCrossStageStatic; kernelHeaders = if crossGNU then gnu.hurdHeaders else linuxHeadersCross; - installLocales = getConfig [ "glibc" "locales" ] false; + installLocales = config.glibc.locales or false; } // lib.optionalAttrs crossGNU { inherit (gnu) machHeaders hurdHeaders libpthreadHeaders mig; @@ -3674,7 +3670,7 @@ let eglibc = callPackage ../development/libraries/eglibc { kernelHeaders = linuxHeaders; - installLocales = getConfig [ "glibc" "locales" ] false; + installLocales = config.glibc.locales or false; }; glibcLocales = callPackage ../development/libraries/glibc/2.13/locales.nix { }; @@ -3782,11 +3778,11 @@ let }; gnutls = callPackage ../development/libraries/gnutls { - guileBindings = getConfig ["gnutls" "guile"] true; + guileBindings = config.gnutls.guile or true; }; gnutls2 = callPackage ../development/libraries/gnutls/2.12.nix { - guileBindings = getConfig ["gnutls" "guile"] true; + guileBindings = config.gnutls.guile or true; }; gnutls_without_guile = gnutls.override { guileBindings = false; }; @@ -3975,7 +3971,7 @@ let libaal = callPackage ../development/libraries/libaal { }; libao = callPackage ../development/libraries/libao { - usePulseAudio = getConfig [ "pulseaudio" ] true; + usePulseAudio = config.pulseaudio or true; }; libarchive = callPackage ../development/libraries/libarchive { }; @@ -4146,7 +4142,7 @@ let libimobiledevice = callPackage ../development/libraries/libimobiledevice { }; libiodbc = callPackage ../development/libraries/libiodbc { - useGTK = getConfig [ "libiodbc" "gtk" ] false; + useGTK = config.libiodbc.gtk or false; }; liblastfmSF = callPackage ../development/libraries/liblastfmSF { }; @@ -4618,12 +4614,12 @@ let pangoxsl = callPackage ../development/libraries/pangoxsl { }; pcre = callPackage ../development/libraries/pcre { - unicodeSupport = getConfig ["pcre" "unicode"] true; + unicodeSupport = config.pcre.unicode or true; cplusplusSupport = !stdenv ? isDietLibC; }; pcre_8_30 = callPackage ../development/libraries/pcre/8.30.nix { - unicodeSupport = getConfig ["pcre" "unicode"] true; + unicodeSupport = config.pcre.unicode or true; cplusplusSupport = !stdenv ? isDietLibC; }; @@ -5357,7 +5353,7 @@ let #monetdb = callPackage ../servers/sql/monetdb { }; mongodb = callPackage ../servers/nosql/mongodb { - useV8 = (getConfig ["mongodb" "useV8"] false); + useV8 = (config.mongodb.useV8 or false); }; mysql4 = import ../servers/sql/mysql { @@ -6074,8 +6070,8 @@ let pam_usb = callPackage ../os-specific/linux/pam_usb { }; pcmciaUtils = callPackage ../os-specific/linux/pcmciautils { - firmware = getConfig ["pcmciaUtils" "firmware"] []; - config = getConfig ["pcmciaUtils" "config"] null; + firmware = config.pcmciaUtils.firmware or []; + config = config.pcmciaUtils.config or null; }; phat = callPackage ../development/libraries/phat { @@ -6667,7 +6663,7 @@ let dvswitch = callPackage ../applications/video/dvswitch { }; dwm = callPackage ../applications/window-managers/dwm { - patches = getConfig [ "dwm" "patches" ] []; + patches = config.dwm.patches or []; }; eaglemode = callPackage ../applications/misc/eaglemode { }; @@ -6700,8 +6696,8 @@ let literal backslashes have changed. */ else overrideGCC stdenv gcc44; - xaw3dSupport = getConfig [ "emacs" "xaw3dSupport" ] false; - gtkGUI = getConfig [ "emacs" "gtkSupport" ] true; + xaw3dSupport = config.emacs.xaw3dSupport or false; + gtkGUI = config.emacs.gtkSupport or true; }; emacs23 = callPackage ../applications/editors/emacs-23 { @@ -6877,7 +6873,7 @@ let grass = import ../applications/misc/grass { inherit (xlibs) libXmu libXext libXp libX11 libXt libSM libICE libXpm libXaw libXrender; - inherit getConfig composableDerivation stdenv fetchurl + inherit config composableDerivation stdenv fetchurl lib flex bison cairo fontconfig gdal zlib ncurses gdbm proj pkgconfig swig blas liblapack libjpeg libpng mysql unixODBC mesa postgresql python @@ -6942,11 +6938,11 @@ let flashplayer9 = callPackage ../applications/networking/browsers/mozilla-plugins/flashplayer-9 { }; flashplayer10 = callPackage ../applications/networking/browsers/mozilla-plugins/flashplayer-10 { - debug = getConfig ["flashplayer" "debug"] false; + debug = config.flashplayer.debug or false; }; flashplayer11 = callPackage ../applications/networking/browsers/mozilla-plugins/flashplayer-11 { - debug = getConfig ["flashplayer" "debug"] false; + debug = config.flashplayer.debug or false; # !!! Fix the dependency on two different builds of nss. }; @@ -7040,7 +7036,7 @@ let gnunet08 = callPackage ../applications/networking/p2p/gnunet/0.8.nix { inherit (gnome) libglade; guile = guile_1_8; - gtkSupport = getConfig [ "gnunet" "gtkSupport" ] true; + gtkSupport = config.gnunet.gtkSupport or true; }; gnunet = callPackage ../applications/networking/p2p/gnunet { }; @@ -7401,7 +7397,7 @@ let avahi = avahi.override { withLibdnssdCompat = true; }; - jackSupport = getConfig [ "mumble" "jackSupport" ] false; + jackSupport = config.mumble.jackSupport or false; }; mutt = callPackage ../applications/networking/mailreaders/mutt { }; @@ -7493,9 +7489,9 @@ let picard = callPackage ../applications/audio/picard { }; pidgin = callPackage ../applications/networking/instant-messengers/pidgin { - openssl = if (getConfig ["pidgin" "openssl"] true) then openssl else null; - gnutls = if (getConfig ["pidgin" "gnutls"] false) then gnutls else null; - libgcrypt = if (getConfig ["pidgin" "gnutls"] false) then libgcrypt else null; + openssl = if (config.pidgin.openssl or true) then openssl else null; + gnutls = if (config.pidgin.gnutls or false) then gnutls else null; + libgcrypt = if (config.pidgin.gnutls or false) then libgcrypt else null; inherit (gnome) startupnotification; }; @@ -7584,7 +7580,7 @@ let rsync = callPackage ../applications/networking/sync/rsync { enableACLs = !(stdenv.isDarwin || stdenv.isSunOS); - enableCopyDevicesPatch = (getConfig ["rsync" "enableCopyDevicesPatch"] false); + enableCopyDevicesPatch = (config.rsync.enableCopyDevicesPatch or false); }; rxvt = callPackage ../applications/misc/rxvt { }; @@ -7617,7 +7613,7 @@ let siproxd = callPackage ../applications/networking/siproxd { }; skype_linux = callPackage_i686 ../applications/networking/instant-messengers/skype { - usePulseAudio = getConfig [ "pulseaudio" ] false; # disabled by default (the 100% cpu bug) + usePulseAudio = config.pulseaudio or false; # disabled by default (the 100% cpu bug) }; st = callPackage ../applications/misc/st { }; @@ -7712,7 +7708,7 @@ let taskjuggler = callPackage ../applications/misc/taskjuggler { # KDE support is not working yet. inherit (kde3) kdelibs kdebase; - withKde = getConfig [ "taskJuggler" "kde" ] false; + withKde = config.taskJuggler.kde or false; }; taskwarrior = callPackage ../applications/misc/taskwarrior { }; @@ -7768,7 +7764,7 @@ let unison = callPackage ../applications/networking/sync/unison { inherit (ocamlPackages) lablgtk; - enableX11 = getConfig [ "unison" "enableX11" ] true; + enableX11 = config.unison.enableX11 or true; }; uucp = callPackage ../tools/misc/uucp { }; @@ -7798,19 +7794,15 @@ let vimHugeX = vim_configurable; vim_configurable = import ../applications/editors/vim/configurable.nix { - inherit (pkgs) fetchurl stdenv ncurses pkgconfig gettext composableDerivation lib - getConfig; - inherit (pkgs.xlibs) libX11 libXext libSM libXpm - libXt libXaw libXau libXmu libICE; + inherit (pkgs) fetchurl stdenv ncurses pkgconfig gettext composableDerivation lib config; + inherit (pkgs.xlibs) libX11 libXext libSM libXpm libXt libXaw libXau libXmu libICE; inherit (pkgs) glib gtk; features = "huge"; # one of tiny, small, normal, big or huge # optional features by passing # python # TODO mzschemeinterp perlinterp inherit (pkgs) python perl tcl ruby /*x11*/; - lua = pkgs.lua5; - # optional features by flags flags = [ "X11" ]; # only flag "X11" by now }; @@ -7859,7 +7851,7 @@ let libixp = libixp_for_wmii; inherit fetchurl /* fetchhg */ stdenv gawk; inherit (xlibs) libX11 xextproto libXt libXext; - includeUnpack = getConfig ["stdenv" "includeUnpack"] false; + includeUnpack = config.stdenv.includeUnpack or false; }; wordnet = callPackage ../applications/misc/wordnet { }; @@ -7871,23 +7863,23 @@ let inherit stdenv makeWrapper makeDesktopItem browser browserName desktopName nameSuffix icon; plugins = let - enableAdobeFlash = getConfig [ browserName "enableAdobeFlash" ] true; - enableGnash = getConfig [ browserName "enableGnash" ] false; + enableAdobeFlash = config.browserNameenableAdobeFlash or true; + enableGnash = config.browserNameenableGnash or false; in assert !(enableGnash && enableAdobeFlash); ([ ] ++ lib.optional enableGnash gnash ++ lib.optional enableAdobeFlash flashplayer # RealPlayer is disabled by default for legal reasons. - ++ lib.optional (system != "i686-linux" && getConfig [browserName "enableRealPlayer"] false) RealPlayer - ++ lib.optional (getConfig [browserName "enableDjvu"] false) (djview4) - ++ lib.optional (getConfig [browserName "enableMPlayer"] false) (MPlayerPlugin browser) - ++ lib.optional (getConfig [browserName "enableGeckoMediaPlayer"] false) gecko_mediaplayer - ++ lib.optional (supportsJDK && getConfig [browserName "jre"] false && jrePlugin ? mozillaPlugin) jrePlugin - ++ lib.optional (getConfig [browserName "enableGoogleTalkPlugin"] false) google_talk_plugin + ++ lib.optional (system != "i686-linux" && config.browserNameenableRealPlayer or false) RealPlayer + ++ lib.optional (config.browserNameenableDjvu or false) (djview4) + ++ lib.optional (config.browserNameenableMPlayer or false) (MPlayerPlugin browser) + ++ lib.optional (config.browserNameenableGeckoMediaPlayer or false) gecko_mediaplayer + ++ lib.optional (supportsJDK && config.browserNamejre or false && jrePlugin ? mozillaPlugin) jrePlugin + ++ lib.optional (config.browserNameenableGoogleTalkPlugin or false) google_talk_plugin ); libs = - if getConfig [ browserName "enableQuakeLive" ] false + if config.browserNameenableQuakeLive or false then with xlibs; [ stdenv.gcc libX11 libXxf86dga libXxf86vm libXext libXt alsaLib zlib ] else [ ]; }; @@ -8716,8 +8708,8 @@ let ghostscript = callPackage ../misc/ghostscript { x11Support = false; - cupsSupport = getConfig [ "ghostscript" "cups" ] true; - gnuFork = getConfig [ "ghostscript" "gnu" ] false; + cupsSupport = config.ghostscript.cups or true; + gnuFork = config.ghostscript.gnu or false; }; ghostscriptX = appendToName "with-X" (ghostscript.override { @@ -8753,13 +8745,13 @@ let nix = nixStable; nixStable = callPackage ../tools/package-management/nix { - storeDir = getConfig [ "nix" "storeDir" ] "/nix/store"; - stateDir = getConfig [ "nix" "stateDir" ] "/nix/var"; + storeDir = config.nix.storeDir or "/nix/store"; + stateDir = config.nix.stateDir or "/nix/var"; }; nixUnstable = callPackage ../tools/package-management/nix/unstable.nix { - storeDir = getConfig [ "nix" "storeDir" ] "/nix/store"; - stateDir = getConfig [ "nix" "stateDir" ] "/nix/var"; + storeDir = config.nix.storeDir or "/nix/store"; + stateDir = config.nix.stateDir or "/nix/var"; }; nixCustomFun = src: preConfigure: enableScripts: configureFlags: @@ -8779,13 +8771,13 @@ let disnix = callPackage ../tools/package-management/disnix { }; disnix_activation_scripts = callPackage ../tools/package-management/disnix/activation-scripts { - enableApacheWebApplication = getConfig ["disnix" "enableApacheWebApplication"] false; - enableAxis2WebService = getConfig ["disnix" "enableAxis2WebService"] false; - enableEjabberdDump = getConfig ["disnix" "enableEjabberdDump"] false; - enableMySQLDatabase = getConfig ["disnix" "enableMySQLDatabase"] false; - enablePostgreSQLDatabase = getConfig ["disnix" "enablePostgreSQLDatabase"] false; - enableSubversionRepository = getConfig ["disnix" "enableSubversionRepository"] false; - enableTomcatWebApplication = getConfig ["disnix" "enableTomcatWebApplication"] false; + enableApacheWebApplication = config.disnix.enableApacheWebApplication or false; + enableAxis2WebService = config.disnix.enableAxis2WebService or false; + enableEjabberdDump = config.disnix.enableEjabberdDump or false; + enableMySQLDatabase = config.disnix.enableMySQLDatabase or false; + enablePostgreSQLDatabase = config.disnix.enablePostgreSQLDatabase or false; + enableSubversionRepository = config.disnix.enableSubversionRepository or false; + enableTomcatWebApplication = config.disnix.enableTomcatWebApplication or false; }; disnixos = callPackage ../tools/package-management/disnix/disnixos { }; @@ -8830,12 +8822,12 @@ let xlockmore = callPackage ../misc/screensavers/xlockmore { }; saneBackends = callPackage ../misc/sane-backends { - gt68xxFirmware = getConfig ["sane" "gt68xxFirmware"] null; - hotplugSupport = getConfig ["sane" "hotplugSupport"] true; + gt68xxFirmware = config.sane.gt68xxFirmware or null; + hotplugSupport = config.sane.hotplugSupport or true; }; saneBackendsSnapshot = callPackage ../misc/sane-backends/snapshot.nix { - gt68xxFirmware = getConfig ["sane" "gt68xxFirmware"] null; + gt68xxFirmware = config.sane.gt68xxFirmware or null; }; saneFrontends = callPackage ../misc/sane-front { }; diff --git a/pkgs/top-level/haskell-defaults.nix b/pkgs/top-level/haskell-defaults.nix index 01b4f2e75abe..803b45061bd5 100644 --- a/pkgs/top-level/haskell-defaults.nix +++ b/pkgs/top-level/haskell-defaults.nix @@ -8,7 +8,7 @@ # The actual Haskell packages are composed in haskell-packages.nix. There is # more documentation in there. -{ makeOverridable, lowPrio, stdenv, pkgs, newScope, getConfig, callPackage } : rec { +{ makeOverridable, lowPrio, stdenv, pkgs, newScope, config, callPackage } : rec { # Preferences functions. # @@ -123,13 +123,13 @@ # prefFun = self : super : self; enableLibraryProfiling = if profExplicit then profDefault - else getConfig [ "cabal" "libraryProfiling" ] profDefault; + else config.cabal.libraryProfiling or profDefault; ghc = callPackage ghcPath { ghc = ghcBinary; }; }); defaultVersionPrioFun = profDefault : - if getConfig [ "cabal" "libraryProfiling" ] false == profDefault + if config.cabal.libraryProfiling or false == profDefault then (x : x) else lowPrio;