replacing applyAndFun by lib.defaultOverridableDelayableArgs

applyAndFun has a bug resulting in the same arg beeing added more than
once when using a concatenating merge function for the attr set.

I've tried giving the function a name "overridableDelayableArgs" which
resembles its usage much more.

important refactoring:
  applyAndFun had .fun and .funMerge only when passing the merge
  function lib.mergeOrApply

  composableDerivation {
    initial = {
      ...
    };
  }

to

  overridableDelayableArgs has always .replace and .merge
  composableDerivation {} {
    ...
  }

svn path=/nixpkgs/trunk/; revision=14428
This commit is contained in:
Marc Weber 2009-03-06 23:21:28 +00:00
parent 51289a41b0
commit b56ed35851
15 changed files with 564 additions and 593 deletions

View File

@ -2,8 +2,7 @@
# but I have gvim with python support now :) - Marc # but I have gvim with python support now :) - Marc
args: with args; args: with args;
let inherit (args.composableDerivation) composableDerivation edf; in let inherit (args.composableDerivation) composableDerivation edf; in
composableDerivation { composableDerivation {} {
initial = {
name = "vim_configurable-7.1"; name = "vim_configurable-7.1";
@ -73,6 +72,4 @@ composableDerivation {
homepage = "www.vim.org"; homepage = "www.vim.org";
}; };
};
} }

View File

@ -1,8 +1,6 @@
args: with args; args: with args;
let inherit (args.composableDerivation) composableDerivation edf; in let inherit (args.composableDerivation) composableDerivation edf; in
composableDerivation { composableDerivation {} {
initial = {
name = "sox-14.0.0"; name = "sox-14.0.0";
@ -57,5 +55,4 @@ composableDerivation {
name="libsamplerate Commercial Use License"; name="libsamplerate Commercial Use License";
} ]; } ];
}; };
};
} }

View File

@ -3,8 +3,7 @@ let edf = composableDerivation.edf;
optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${__getAttr attr args}/incclude" optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${__getAttr attr args}/incclude"
+ " -D${name}_LIBRARY=${__getAttr attr args}/lib "; # lib 64? + " -D${name}_LIBRARY=${__getAttr attr args}/lib "; # lib 64?
in in
composableDerivation.composableDerivation { composableDerivation.composableDerivation {} {
initial = {
buildInputs = [ gdal cmake qt flex bison proj geos x11 sqlite gsl]; buildInputs = [ gdal cmake qt flex bison proj geos x11 sqlite gsl];
cfgOption = [ cfgOption = [
@ -41,5 +40,4 @@ composableDerivation.composableDerivation {
#configurePhase="./autogen.sh --prefix=\$out --with-gdal=\$gdal/bin/gdal-config --with-qtdir=\$qt"; #configurePhase="./autogen.sh --prefix=\$out --with-gdal=\$gdal/bin/gdal-config --with-qtdir=\$qt";
# buildPhases="unpackPhase buildPhase"; # buildPhases="unpackPhase buildPhase";
};
} }

View File

@ -1,8 +1,7 @@
args: with args; args: with args;
let edf = composableDerivation.edf; let edf = composableDerivation.edf;
wwf = composableDerivation.wwf; in wwf = composableDerivation.wwf; in
composableDerivation.composableDerivation { composableDerivation.composableDerivation {} {
initial = {
name="hugs98"; name="hugs98";
@ -52,5 +51,4 @@ composableDerivation.composableDerivation {
description = "The HUGS98 Haskell <interpreter"; description = "The HUGS98 Haskell <interpreter";
homepage = http://www.haskell.org/hugs; homepage = http://www.haskell.org/hugs;
}; };
};
} }

View File

@ -1,7 +1,6 @@
args: with args; args: with args;
let edf = composableDerivation.edf; in let edf = composableDerivation.edf; in
composableDerivation.composableDerivation { composableDerivation.composableDerivation {} {
initial = {
name = "roadsend-2.9.3"; name = "roadsend-2.9.3";
buildInputs = [bigloo curl]; buildInputs = [bigloo curl];
flags = edf { name = "pcre"; } flags = edf { name = "pcre"; }
@ -34,5 +33,4 @@ composableDerivation.composableDerivation {
# Runtime license is LPGL 2.1 # Runtime license is LPGL 2.1
license = ["GPL2"]; license = ["GPL2"];
}; };
};
} }

View File

@ -4,8 +4,7 @@ args: with args;
let inherit (args.composableDerivation) composableDerivation edf wwf; in let inherit (args.composableDerivation) composableDerivation edf wwf; in
composableDerivation { composableDerivation {} ( fixed : {
initial = fixed : {
name = "php_configurable-${version}"; name = "php_configurable-${version}";
@ -175,6 +174,4 @@ composableDerivation {
patches = [./fix.patch]; patches = [./fix.patch];
}; })
}

View File

@ -129,7 +129,7 @@ in
### python libraries: ### python libraries:
wxPythonBaseFun = (t.pythonLibSetup.merge (a : wxPythonBaseFun = (t.pythonLibSetup.merge (a :
let inherit (a.fixed) wxGTK version; in let inherit (a.fixed.passthru) wxGTK; inherit (a.fixed) version; in
{ {
buildInputs = [p.pkgconfig wxGTK (wxGTK.gtk)]; buildInputs = [p.pkgconfig wxGTK (wxGTK.gtk)];
setupFlags=["WXPORT=gtk2 NO_HEADERS=1 BUILD_GLCANVAS=0 BUILD_OGL=0 UNICODE=1"]; setupFlags=["WXPORT=gtk2 NO_HEADERS=1 BUILD_GLCANVAS=0 BUILD_OGL=0 UNICODE=1"];
@ -196,7 +196,7 @@ in
# If you install dozens of python packages this might be bloat. # If you install dozens of python packages this might be bloat.
# So I think the overhead of installing these packages into the same store path should be prefered. # So I think the overhead of installing these packages into the same store path should be prefered.
pygtkBaseFun = (t.pythonLibStub.merge (a : pygtkBaseFun = (t.pythonLibStub.merge (a :
let inherit (a.fixed) glib gtk; in lib.mergeAttrsByFuncDefaults [ let inherit (a.fixed.passthru) glib gtk; in lib.mergeAttrsByFuncDefaults [
{ {
unpackPhase = "true"; unpackPhase = "true";
configurePhase = "true"; configurePhase = "true";
@ -312,7 +312,7 @@ in
pygtk212 = t.pygtkBaseFun.merge (a : { pygtk212 = t.pygtkBaseFun.merge (a : {
version = "2.12.1"; version = "2.12.1";
name = "pygobject-${a.fixed.pygobjectVersion}-and-pygtk-${a.fixed.version}"; name = "pygobject-${a.fixed.passthru.pygobjectVersion}-and-pygtk-${a.fixed.version}";
pygtkSrc = fetchurl { pygtkSrc = fetchurl {
url = http://ftp.acc.umu.se/pub/GNOME/sources/pygtk/2.12/pygtk-2.12.1.tar.bz2; url = http://ftp.acc.umu.se/pub/GNOME/sources/pygtk/2.12/pygtk-2.12.1.tar.bz2;
sha256 = "0gg13xgr7y9sppw8bdys042928nc66czn74g60333c4my95ys021"; sha256 = "0gg13xgr7y9sppw8bdys042928nc66czn74g60333c4my95ys021";

View File

@ -1,7 +1,6 @@
args: with args; args: with args;
let inherit (args.composableDerivation) composableDerivation edf; in let inherit (args.composableDerivation) composableDerivation edf; in
composableDerivation { composableDerivation {} {
initial = {
name = "fltk-2.0.x-r6483"; name = "fltk-2.0.x-r6483";
@ -43,5 +42,4 @@ composableDerivation {
description = "a C++ cross platform lightweight gui library binding"; description = "a C++ cross platform lightweight gui library binding";
homepage = http://www.fltk.org; homepage = http://www.fltk.org;
}; };
};
} }

View File

@ -1,8 +1,6 @@
args: with args; args: with args;
let inherit (args.composableDerivation) composableDerivation edf; in let inherit (args.composableDerivation) composableDerivation edf; in
composableDerivation { composableDerivation {} {
initial = {
buildInputs = [ "which" ]; # which is needed for the autogen.sh buildInputs = [ "which" ]; # which is needed for the autogen.sh
@ -34,5 +32,4 @@ composableDerivation {
homepage = http://geos.refractions.net/; homepage = http://geos.refractions.net/;
license = "GPL"; license = "GPL";
}; };
};
} }

View File

@ -1,7 +1,7 @@
args: with args; args: with args;
let inherit (args.composableDerivation) composableDerivation edf; in let inherit (args.composableDerivation) composableDerivation edf; in
composableDerivation { composableDerivation {} {
initial = {
flags = { } flags = { }
# TODO! implement flags # TODO! implement flags
# I want to get kino and cinelerra working. That's why I don't spend more time on this now # I want to get kino and cinelerra working. That's why I don't spend more time on this now
@ -25,5 +25,4 @@ composableDerivation {
# you can choose one of the following licenses: # you can choose one of the following licenses:
license = []; license = [];
}; };
};
} }

View File

@ -5,8 +5,7 @@ let
name = "ragel-${version}"; name = "ragel-${version}";
in in
composableDerivation.composableDerivation { composableDerivation.composableDerivation {} {
initial = rec {
inherit name; inherit name;
src = fetchurl { src = fetchurl {
url = "http://www.complang.org/ragel/${name}.tar.gz"; url = "http://www.complang.org/ragel/${name}.tar.gz";
@ -40,5 +39,4 @@ composableDerivation.composableDerivation {
description = "State machine compiler"; description = "State machine compiler";
license = "GPL-2"; license = "GPL-2";
}; };
};
} }

View File

@ -12,14 +12,12 @@ let inherit (lib) nv nvs; in
# TODO add newer example using new syntax (kernel derivation proposal -> mailinglist) # TODO add newer example using new syntax (kernel derivation proposal -> mailinglist)
composableDerivation = { composableDerivation = {
mkDerivation ? pkgs.stdenv.mkDerivation, mkDerivation ? pkgs.stdenv.mkDerivation,
# initial set of arguments to be passed to stdenv.mkDerivation passing prepareDerivationArgs by default
initial ? {},
# list of functions to be applied before defaultOverridableDelayableArgs removes removeAttrs names # list of functions to be applied before defaultOverridableDelayableArgs removes removeAttrs names
# prepareDerivationArgs handles derivation configurations # prepareDerivationArgs handles derivation configurations
# applyPreTidy ? [ lib.prepareDerivationArgs ], applyPreTidy ? [ lib.prepareDerivationArgs ],
applyPreTidy ? [],
# consider adding addtional elements by derivation.merge { removeAttrs = ["elem"]; };
removeAttrs ? ["cfg" "flags"] removeAttrs ? ["cfg" "flags"]
}: (lib.defaultOverridableDelayableArgs ( a: mkDerivation a) }: (lib.defaultOverridableDelayableArgs ( a: mkDerivation a)

View File

@ -1,9 +1,8 @@
args: with args; args: with args;
let edf = composableDerivation.edf; let edf = composableDerivation.edf;
name = "gxemul-0.4.6"; in name = "gxemul-0.4.6"; in
composableDerivation.composableDerivation { composableDerivation.composableDerivation {} {
initial = {
inherit name; inherit name;
flags = { flags = {
doc = { installPhase = "ensureDir \$out/share/${name}; cp -r doc \$out/share/${name};"; implies = "man"; }; doc = { installPhase = "ensureDir \$out/share/${name}; cp -r doc \$out/share/${name};"; implies = "man"; };
@ -33,5 +32,4 @@ composableDerivation.composableDerivation {
}; };
mergeAttrBy = { installPhase = a : b : "${a}\n${b}"; }; mergeAttrBy = { installPhase = a : b : "${a}\n${b}"; };
};
} }

View File

@ -2,8 +2,7 @@
# still much to test but it compiles now # still much to test but it compiles now
args: args:
let inherit (args.composableDerivation) composableDerivation edf; in let inherit (args.composableDerivation) composableDerivation edf; in
composableDerivation { composableDerivation {} {
initial = {
buildInputs = [ args.pkgconfig ]; buildInputs = [ args.pkgconfig ];
flags = flags =
# FIXME: tidy up # FIXME: tidy up
@ -49,5 +48,4 @@ composableDerivation {
homepage = "http://jackaudio.org"; homepage = "http://jackaudio.org";
license = "GPL"; license = "GPL";
}; };
};
} }

View File

@ -8946,7 +8946,7 @@ let
}; };
# doesn't compile yet - in case someone else want's to continue .. # doesn't compile yet - in case someone else want's to continue ..
qgis = composedArgsAndFun (selectVersion ../applications/misc/qgis "0.11.0") { qgis = (selectVersion ../applications/misc/qgis "0.11.0") {
inherit composableDerivation fetchsvn stdenv flex lib inherit composableDerivation fetchsvn stdenv flex lib
ncurses fetchurl perl cmake gdal geos proj x11 ncurses fetchurl perl cmake gdal geos proj x11
gsl libpng zlib bison gsl libpng zlib bison