I take out getPkgConfig. It looks to me as if it needed a solution, but noone took action.

I take action before much discussion.
For what I see:
- getPkgConfig problems are hard to track
- config.nix trying to forecast getPkgConfig behaviour looks me as a bad approach,
  and people should not trust such a config.nix unless they parsed the whole nixpkgs
  for tricky effects.
- It's not that hard to write config.nix in the style of getConfig
- Every now and then newcomers hit the "'git' is an attribute set while a boolean was expected".

Maybe this will disrupt nixes of some people, and that will be a background on what to discuss.


svn path=/nixpkgs/trunk/; revision=25314
This commit is contained in:
Lluís Batlle i Rossell 2010-12-28 21:07:35 +00:00
parent 7df337558a
commit 4c16325de0
2 changed files with 26 additions and 29 deletions

View File

@ -4,7 +4,7 @@
args: with args; with pkgs; args: with args; with pkgs;
let let
inherit (pkgs) stdenv fetchurl subversion; inherit (pkgs) stdenv fetchurl subversion;
config = getPkgConfig "git"; config = param: getConfig [ "git" param ];
in in
rec { rec {

View File

@ -174,9 +174,6 @@ let
# inside the set for derivations. # inside the set for derivations.
recurseIntoAttrs = attrs: attrs // {recurseForDerivations = true;}; recurseIntoAttrs = attrs: attrs // {recurseForDerivations = true;};
# Return the first available value in the order: pkg.val, val, or default.
getPkgConfig = pkg : val : default : (getConfig [ pkg val ] (getConfig [ val ] default));
builderDefs = lib.composedArgsAndFun (import ../build-support/builder-defs/builder-defs.nix) { builderDefs = lib.composedArgsAndFun (import ../build-support/builder-defs/builder-defs.nix) {
inherit stringsWithDeps lib stdenv writeScript inherit stringsWithDeps lib stdenv writeScript
fetchurl fetchmtn fetchgit; fetchurl fetchmtn fetchgit;
@ -2649,7 +2646,7 @@ let
adns = import ../development/libraries/adns/1.4.nix { adns = import ../development/libraries/adns/1.4.nix {
inherit stdenv fetchurl; inherit stdenv fetchurl;
static = getPkgConfig "adns" "static" (stdenv ? isStatic || stdenv ? isDietLibC); static = getConfig [ "adns" "static" ] (stdenv ? isStatic || stdenv ? isDietLibC);
}; };
agg = callPackage ../development/libraries/agg { }; agg = callPackage ../development/libraries/agg { };
@ -2945,19 +2942,19 @@ let
glibc29 = callPackage ../development/libraries/glibc-2.9 { glibc29 = callPackage ../development/libraries/glibc-2.9 {
kernelHeaders = linuxHeaders; kernelHeaders = linuxHeaders;
installLocales = getPkgConfig "glibc" "locales" false; installLocales = getConfig [ "glibc" "locales" ] false;
}; };
glibc29Cross = forceBuildDrv (makeOverridable (import ../development/libraries/glibc-2.9) { glibc29Cross = forceBuildDrv (makeOverridable (import ../development/libraries/glibc-2.9) {
inherit stdenv fetchurl; inherit stdenv fetchurl;
gccCross = gccCrossStageStatic; gccCross = gccCrossStageStatic;
kernelHeaders = linuxHeadersCross; kernelHeaders = linuxHeadersCross;
installLocales = getPkgConfig "glibc" "locales" false; installLocales = getConfig [ "glibc" "locales" ] false;
}); });
glibc211 = callPackage ../development/libraries/glibc-2.11 { glibc211 = callPackage ../development/libraries/glibc-2.11 {
kernelHeaders = linuxHeaders; kernelHeaders = linuxHeaders;
installLocales = getPkgConfig "glibc" "locales" false; installLocales = getConfig [ "glibc" "locales" ] false;
machHeaders = null; machHeaders = null;
hurdHeaders = null; hurdHeaders = null;
gccCross = null; gccCross = null;
@ -2969,7 +2966,7 @@ let
inherit stdenv fetchurl; inherit stdenv fetchurl;
gccCross = gccCrossStageStatic; gccCross = gccCrossStageStatic;
kernelHeaders = if crossGNU then hurdHeaders else linuxHeadersCross; kernelHeaders = if crossGNU then hurdHeaders else linuxHeadersCross;
installLocales = getPkgConfig "glibc" "locales" false; installLocales = getConfig [ "glibc" "locales" ] false;
} }
// //
@ -2996,7 +2993,7 @@ let
eglibc = callPackage ../development/libraries/eglibc { eglibc = callPackage ../development/libraries/eglibc {
kernelHeaders = linuxHeaders; kernelHeaders = linuxHeaders;
installLocales = getPkgConfig "glibc" "locales" false; installLocales = getConfig [ "glibc" "locales" ] false;
}; };
glibcLocales = callPackage ../development/libraries/glibc-2.11/locales.nix { }; glibcLocales = callPackage ../development/libraries/glibc-2.11/locales.nix { };
@ -3389,7 +3386,7 @@ let
libimobiledevice = callPackage ../development/libraries/libimobiledevice { }; libimobiledevice = callPackage ../development/libraries/libimobiledevice { };
libiodbc = callPackage ../development/libraries/libiodbc { libiodbc = callPackage ../development/libraries/libiodbc {
useGTK = getPkgConfig "libiodbc" "gtk" false; useGTK = getConfig [ "libiodbc" "gtk" ] false;
}; };
libktorrent = newScope pkgs.kde4 ../development/libraries/libktorrent { }; libktorrent = newScope pkgs.kde4 ../development/libraries/libktorrent { };
@ -5601,8 +5598,8 @@ let
emacs = emacs23; emacs = emacs23;
emacs22 = callPackage ../applications/editors/emacs-22 { emacs22 = callPackage ../applications/editors/emacs-22 {
xaw3dSupport = getPkgConfig "emacs" "xaw3dSupport" false; xaw3dSupport = getConfig [ "emacs" "xaw3dSupport" ] false;
gtkGUI = getPkgConfig "emacs" "gtkSupport" true; gtkGUI = getConfig [ "emacs" "gtkSupport" ] true;
}; };
emacs23 = callPackage ../applications/editors/emacs-23 { emacs23 = callPackage ../applications/editors/emacs-23 {
@ -5616,11 +5613,11 @@ let
}; };
emacsSnapshot = lowPrio (callPackage ../applications/editors/emacs-snapshot { emacsSnapshot = lowPrio (callPackage ../applications/editors/emacs-snapshot {
xawSupport = getPkgConfig "emacs" "xawSupport" false; xawSupport = getConfig [ "emacs" "xawSupport" ] false;
xaw3dSupport = getPkgConfig "emacs" "xaw3dSupport" false; xaw3dSupport = getConfig [ "emacs" "xaw3dSupport" ] false;
gtkGUI = getPkgConfig "emacs" "gtkSupport" true; gtkGUI = getConfig [ "emacs" "gtkSupport" ] true;
xftSupport = getPkgConfig "emacs" "xftSupport" true; xftSupport = getConfig [ "emacs" "xftSupport" ] true;
dbusSupport = getPkgConfig "emacs" "dbusSupport" true; dbusSupport = getConfig [ "emacs" "dbusSupport" ] true;
}); });
emacsPackages = emacs: self: let callPackage = newScope self; in rec { emacsPackages = emacs: self: let callPackage = newScope self; in rec {
@ -5951,8 +5948,8 @@ let
inherit (perlPackages) TextMarkdown URI HTMLParser HTMLScrubber inherit (perlPackages) TextMarkdown URI HTMLParser HTMLScrubber
HTMLTemplate TimeDate CGISession DBFile CGIFormBuilder LocaleGettext HTMLTemplate TimeDate CGISession DBFile CGIFormBuilder LocaleGettext
RpcXML XMLSimple PerlMagick; RpcXML XMLSimple PerlMagick;
gitSupport = getPkgConfig "ikiwiki" "git" false; gitSupport = getConfig [ "ikiwiki" "git" ] false;
monotoneSupport = getPkgConfig "ikiwiki" "monotone" false; monotoneSupport = getConfig [ "ikiwiki" "monotone" ] false;
extraUtils = []; extraUtils = [];
}; };
@ -6419,7 +6416,7 @@ let
# KDE support is not working yet. # KDE support is not working yet.
inherit (kde3) kdelibs kdebase; inherit (kde3) kdelibs kdebase;
withKde = getPkgConfig "taskJuggler" "kde" false; withKde = getConfig [ "taskJuggler" "kde" ] false;
}; };
thinkingRock = callPackage ../applications/misc/thinking-rock { }; thinkingRock = callPackage ../applications/misc/thinking-rock { };
@ -7210,7 +7207,7 @@ let
ghostscript = callPackage ../misc/ghostscript { ghostscript = callPackage ../misc/ghostscript {
x11Support = false; x11Support = false;
cupsSupport = getPkgConfig "ghostscript" "cups" true; cupsSupport = getConfig [ "ghostscript" "cups" ] true;
}; };
ghostscriptX = appendToName "with-X" (ghostscript.override { ghostscriptX = appendToName "with-X" (ghostscript.override {
@ -7246,19 +7243,19 @@ let
nix = nixStable; nix = nixStable;
nixStable = callPackage ../tools/package-management/nix { nixStable = callPackage ../tools/package-management/nix {
storeDir = getPkgConfig "nix" "storeDir" "/nix/store"; storeDir = getConfig [ "nix" "storeDir" ] "/nix/store";
stateDir = getPkgConfig "nix" "stateDir" "/nix/var"; stateDir = getConfig [ "nix" "stateDir" ] "/nix/var";
}; };
nixUnstable = callPackage ../tools/package-management/nix/unstable.nix { nixUnstable = callPackage ../tools/package-management/nix/unstable.nix {
storeDir = getPkgConfig "nix" "storeDir" "/nix/store"; storeDir = getConfig [ "nix" "storeDir" ] "/nix/store";
stateDir = getPkgConfig "nix" "stateDir" "/nix/var"; stateDir = getConfig [ "nix" "stateDir" ] "/nix/var";
}; };
# The SQLite branch. # The SQLite branch.
nixSqlite = lowPrio (callPackage ../tools/package-management/nix/sqlite.nix { nixSqlite = lowPrio (callPackage ../tools/package-management/nix/sqlite.nix {
storeDir = getPkgConfig "nix" "storeDir" "/nix/store"; storeDir = getConfig [ "nix" "storeDir" ] "/nix/store";
stateDir = getPkgConfig "nix" "stateDir" "/nix/var"; stateDir = getConfig [ "nix" "stateDir" ] "/nix/var";
}); });
nixCustomFun = src: preConfigure: enableScripts: configureFlags: nixCustomFun = src: preConfigure: enableScripts: configureFlags:
@ -7319,7 +7316,7 @@ let
rssglx = callPackage ../misc/screensavers/rss-glx { }; rssglx = callPackage ../misc/screensavers/rss-glx { };
xlockmore = callPackage ../misc/screensavers/xlockmore { xlockmore = callPackage ../misc/screensavers/xlockmore {
pam = if getPkgConfig "xlockmore" "pam" true then pam else null; pam = if getConfig [ "xlockmore" "pam" ] true then pam else null;
}; };
saneBackends = callPackage ../misc/sane-backends { saneBackends = callPackage ../misc/sane-backends {