summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMichael Raskin <7c6f434c@mail.ru>2008-01-18 12:36:56 +0000
committerMichael Raskin <7c6f434c@mail.ru>2008-01-18 12:36:56 +0000
commitbc46eaf4047f4cfd3152f3748f114b8743ed4faf (patch)
tree4ba6055a35af6b96427cd5b2186108f8a3551d9c /pkgs
parenta5e0e39cdb575a38216a2a0e9ee25eae5bb05397 (diff)
Some review of builder-defs and dependent files. No rebuild needed. Now it should be possible to override elements in builderDefs
svn path=/nixpkgs/trunk/; revision=10214
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/audacity/default.nix7
-rw-r--r--pkgs/applications/audio/ladspa-plugins/default.nix5
-rw-r--r--pkgs/applications/audio/ladspa-plugins/ladspah.nix5
-rw-r--r--pkgs/applications/audio/snd/default.nix5
-rw-r--r--pkgs/applications/graphics/gocr/0.44.nix5
-rw-r--r--pkgs/applications/graphics/xscreensaver/5.04.nix5
-rw-r--r--pkgs/applications/virtualization/qemu/0.9.0.nix5
-rw-r--r--pkgs/applications/virtualization/qemu/linux-img/0.2.nix5
-rw-r--r--pkgs/applications/virtualization/virtualbox/1.5.2.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/bcop/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/ccsm/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/compiz-manager/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/compizconfig-python/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/config-backend/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/extra/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/libcompizconfig/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz-fusion/main/0.6.0.nix5
-rw-r--r--pkgs/applications/window-managers/compiz/0.6.2.nix5
-rw-r--r--pkgs/applications/window-managers/fbpanel/4.12.nix5
-rw-r--r--pkgs/data/fonts/fontWrap/default.nix7
-rw-r--r--pkgs/development/compilers/qi/9.1.nix5
-rw-r--r--pkgs/development/interpreters/pyrex/0.9.6.nix5
-rw-r--r--pkgs/development/libraries/fftw/default.nix5
-rw-r--r--pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix5
-rw-r--r--pkgs/development/libraries/libdbi/0.8.2.nix5
-rw-r--r--pkgs/development/libraries/libextractor/0.5.18.nix5
-rw-r--r--pkgs/development/tools/misc/indent/2.2.9.nix5
-rw-r--r--pkgs/development/tools/misc/intltool/0.36.2.nix5
-rw-r--r--pkgs/development/tools/misc/ltrace/default.nix5
-rw-r--r--pkgs/games/construo/0.2.2.nix5
-rw-r--r--pkgs/games/fsg/alt-builder.nix8
-rw-r--r--pkgs/lib/strings-with-deps.nix21
-rw-r--r--pkgs/os-specific/linux/atheros/0.9.3.3.nix5
-rw-r--r--pkgs/os-specific/linux/atheros/r2756.nix5
-rw-r--r--pkgs/os-specific/linux/atheros/r3122.nix5
-rw-r--r--pkgs/os-specific/linux/dmidecode/2.9.nix5
-rw-r--r--pkgs/os-specific/linux/dvd+rw-tools/7.0.nix5
-rw-r--r--pkgs/os-specific/linux/kqemu/1.3.0pre11.nix5
-rw-r--r--pkgs/os-specific/linux/module-init-tools/aggregator.nix5
-rw-r--r--pkgs/os-specific/linux/sdparm/1.02.nix5
-rw-r--r--pkgs/tools/misc/relfs/cvs.2007.12.01.nix5
-rw-r--r--pkgs/tools/system/gdmap/0.7.5.nix5
-rw-r--r--pkgs/top-level/builder-defs.nix30
-rw-r--r--pkgs/top-level/template-composing+config.nix5
-rw-r--r--pkgs/top-level/template-composing-builder.nix8
45 files changed, 165 insertions, 111 deletions
diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix
index 56ee6a56ccb88..3eaf1ed3ee08f 100644
--- a/pkgs/applications/audio/audacity/default.nix
+++ b/pkgs/applications/audio/audacity/default.nix
@@ -1,5 +1,5 @@
 args: with args;
-	with (builderDefs { 
+	let localDefs = builderDefs { 
 	  src = 
 		fetchurl {
 			url = mirror://sourceforge/audacity/audacity-src-1.3.3.tar.gz;
@@ -8,7 +8,8 @@ args: with args;
 
   	buildInputs =[(wxGTK null) libogg libvorbis libsndfile libmad pkgconfig gtk 
 		gettext glib];
-	} null);
+	} null;
+	in with localDefs;
 let 
 	postInstall = FullDepEntry ("
 		old_rpath=$(patchelf --print-rpath \$out/bin/audacity);
@@ -25,7 +26,7 @@ stdenv.mkDerivation {
   name = "audacity-1.3.3";
 
   builder = writeScript "audacity-1.3.3-builder"
-		(textClosure [addInputs (doDump "0") (noDepEntry "echo \$PATH; ar --version") doConfigure preBuild doMakeInstall postInstall doForceShare]);
+		(textClosure localDefs [addInputs (doDump "0") (noDepEntry "echo \$PATH; ar --version") doConfigure preBuild doMakeInstall postInstall doForceShare]);
 
   meta = {
     description = "
diff --git a/pkgs/applications/audio/ladspa-plugins/default.nix b/pkgs/applications/audio/ladspa-plugins/default.nix
index 70dc36240c653..9553474791f00 100644
--- a/pkgs/applications/audio/ladspa-plugins/default.nix
+++ b/pkgs/applications/audio/ladspa-plugins/default.nix
@@ -1,5 +1,5 @@
 args: with args;
-	with (builderDefs {
+	let localDefs = builderDefs {
 		src = 
 		fetchurl {
 			url = http://plugin.org.uk/releases/0.4.15/swh-plugins-0.4.15.tar.gz;
@@ -8,6 +8,7 @@ args: with args;
 		buildInputs = [fftw ladspaH pkgconfig];
 		configureFlags = [];
 	} null);
+	in with localDefs;
 let
 	postInstall = FullDepEntry ("
 		ensureDir \$out/share/ladspa/
@@ -17,7 +18,7 @@ in
 stdenv.mkDerivation {
 	name = "swh-plugins-0.4.15";
 	builder = writeScript "swh-plugins-0.4.15-builder"
-		(textClosure [doConfigure doMakeInstall 
+		(textClosure localDefs [doConfigure doMakeInstall 
 			postInstall doForceShare]);
 	meta = {
 		description = "
diff --git a/pkgs/applications/audio/ladspa-plugins/ladspah.nix b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
index b526e48b10ee1..65647cf0a22d6 100644
--- a/pkgs/applications/audio/ladspa-plugins/ladspah.nix
+++ b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
@@ -6,10 +6,11 @@ let
 		sha256 = "1b908csn85ng9sz5s5d1mqk711cmawain2z8px2ajngihdrynb67";
 	};
 in
-	with builderDefs {
+	let localDefs = builderDefs {
 		buildInputs = [];
 		inherit src;
 	} null;
+	in with localDefs;
 let
 	copyFile = FullDepEntry ("
 		ensureDir \$out/include
@@ -19,7 +20,7 @@ in
 stdenv.mkDerivation {
 	name = "ladspa.h";
 	builder = writeScript "ladspa.h-builder"
-		(textClosure [copyFile]);
+		(textClosure localDefs [copyFile]);
 	meta = {
 		description = "
 	LADSPA format audio plugins.
diff --git a/pkgs/applications/audio/snd/default.nix b/pkgs/applications/audio/snd/default.nix
index 9a650570a6d2f..961d82fb88935 100644
--- a/pkgs/applications/audio/snd/default.nix
+++ b/pkgs/applications/audio/snd/default.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = 
 	fetchurl {
 		url = ftp://ccrma-ftp.stanford.edu/pub/Lisp/snd-9.4.tar.gz;
@@ -20,6 +20,7 @@ args : with args;
 			++ (lib.optional (args ? sndlib) "--with-midi" )
 			;
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 	let preBuild = FullDepEntry ("
 		cp config.log /tmp/snd-config.log
 	") [minInit doUnpack];
@@ -27,7 +28,7 @@ in
 stdenv.mkDerivation rec {
 	name = "Snd-9.4";
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure preBuild doMakeInstall doForceShare]);
+		(textClosure localDefs [doConfigure preBuild doMakeInstall doForceShare]);
 	meta = {
 		description = "
 		Snd sound editor.
diff --git a/pkgs/applications/graphics/gocr/0.44.nix b/pkgs/applications/graphics/gocr/0.44.nix
index 4bf7bda50cb24..b415fd6fb1256 100644
--- a/pkgs/applications/graphics/gocr/0.44.nix
+++ b/pkgs/applications/graphics/gocr/0.44.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 fetchurl {
 		url = http://prdownloads.sourceforge.net/jocr/gocr-0.44.tar.gz;
@@ -9,10 +9,11 @@ fetchurl {
 		buildInputs = [];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "gocr";
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		GPL Optical Character Recognition
diff --git a/pkgs/applications/graphics/xscreensaver/5.04.nix b/pkgs/applications/graphics/xscreensaver/5.04.nix
index 132bf997e18cd..afdab99999f47 100644
--- a/pkgs/applications/graphics/xscreensaver/5.04.nix
+++ b/pkgs/applications/graphics/xscreensaver/5.04.nix
@@ -1,4 +1,4 @@
-args : with args; with builderDefs (args // {
+args : with args; let localDefs = builderDefs (args // {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://www.jwz.org/xscreensaver/xscreensaver-5.04.tar.gz;
@@ -20,6 +20,7 @@ args : with args; with builderDefs (args // {
 				" --with-hackdir=\$out/share/xscreensaver-hacks ")
 		];
 	}) null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 	preConfigure = FullDepEntry ("
 		sed -e 's%@GTK_DATADIR@%@datadir@% ; s%@PO_DATADIR@%@datadir@%' "+
@@ -29,7 +30,7 @@ in
 stdenv.mkDerivation rec {
 	name = "xscreensaver-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	The X screensaver daemon. Run xscreensaver-demo to configure.
diff --git a/pkgs/applications/virtualization/qemu/0.9.0.nix b/pkgs/applications/virtualization/qemu/0.9.0.nix
index 8604f5ae66b75..439ec34a8c380 100644
--- a/pkgs/applications/virtualization/qemu/0.9.0.nix
+++ b/pkgs/applications/virtualization/qemu/0.9.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://fabrice.bellard.free.fr/qemu/qemu-0.9.0.tar.gz;
@@ -9,6 +9,7 @@ args : with args;
 		buildInputs = [ SDL zlib which ];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 preConfigure = FullDepEntry ("
   gcc --version
@@ -17,7 +18,7 @@ in
 stdenv.mkDerivation rec {
 	name = "qemu-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [ preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [ preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		QEmu processor emulator.
diff --git a/pkgs/applications/virtualization/qemu/linux-img/0.2.nix b/pkgs/applications/virtualization/qemu/linux-img/0.2.nix
index 02ac87ef2e2fc..99d222070c2d4 100644
--- a/pkgs/applications/virtualization/qemu/linux-img/0.2.nix
+++ b/pkgs/applications/virtualization/qemu/linux-img/0.2.nix
@@ -1,6 +1,6 @@
 
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://fabrice.bellard.free.fr/qemu/linux-0.2.img.bz2;
@@ -9,6 +9,7 @@ args : with args;
 		buildInputs = [];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 doCopy = FullDepEntry ("
   ensureDir \$out/share/qemu-images
@@ -18,7 +19,7 @@ in
 stdenv.mkDerivation rec {
 	name = "QEmu-Linux-Image-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doCopy doForceShare doPropagate]);
+		(textClosure localDefs [doCopy doForceShare doPropagate]);
 	meta = {
 		description = "
 		${abort "Write a description"}
diff --git a/pkgs/applications/virtualization/virtualbox/1.5.2.nix b/pkgs/applications/virtualization/virtualbox/1.5.2.nix
index e633c55a26347..e8f2988ade2a0 100644
--- a/pkgs/applications/virtualization/virtualbox/1.5.2.nix
+++ b/pkgs/applications/virtualization/virtualbox/1.5.2.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://www.virtualbox.org/download/1.5.2/VirtualBox-1.5.2_OSE.tar.bz2;
@@ -9,10 +9,11 @@ args : with args;
 		      wine jre libxslt libIDL SDL qt3 openssl zlib];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "VirtualBox-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		Virtual Box is just software for running virtual machines. 
diff --git a/pkgs/applications/window-managers/compiz-fusion/bcop/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/bcop/0.6.0.nix
index 1072e9b363c11..6337d6a4ebe02 100644
--- a/pkgs/applications/window-managers/compiz-fusion/bcop/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/bcop/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0/compiz-bcop-0.6.0.tar.bz2;
@@ -9,6 +9,7 @@ args : with args;
 		propagatedBuildInputs = [getopt libxslt];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 	fixPkgconfig = FullDepEntry ("
 		ensureDir \$out/lib
@@ -21,7 +22,7 @@ in
 stdenv.mkDerivation rec {
 	name = "compiz-bcop-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doAutotools doConfigure doMakeInstall fixPkgconfig fixInterpreter doForceShare 
+		(textClosure localDefs [doAutotools doConfigure doMakeInstall fixPkgconfig fixInterpreter doForceShare 
 			doPropagate]);
 	inherit propagatedBuildInputs;
 	meta = {
diff --git a/pkgs/applications/window-managers/compiz-fusion/ccsm/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/ccsm/0.6.0.nix
index fba1c5d995f61..6e3448bebf81d 100644
--- a/pkgs/applications/window-managers/compiz-fusion/ccsm/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/ccsm/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0/ccsm-0.6.0.tar.bz2;
@@ -15,10 +15,11 @@ args : with args;
 			"PYTHONPATH" "$(toPythonPath ${pygtk})/gtk-2.0"
 		];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "compizconfig-settings-"+args.version;
 	builder = writeScript (name + "-builder")
-		(textClosure [installPythonPackage (doWrap "\$out/bin/ccsm")]);
+		(textClosure localDefs [installPythonPackage (doWrap "\$out/bin/ccsm")]);
 	meta = {
 		description = "
 	Compiz Settings Manager
diff --git a/pkgs/applications/window-managers/compiz-fusion/compiz-manager/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/compiz-manager/0.6.0.nix
index a388550748083..6033ea1663af3 100644
--- a/pkgs/applications/window-managers/compiz-fusion/compiz-manager/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/compiz-manager/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0/compiz-manager-0.6.0.tar.bz2;
@@ -20,6 +20,7 @@ args : with args;
 			"XORG_DRIVER_PATH" "/nix/store/.*"
 		]];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let
 	install = FullDepEntry ("
 		sed -e '/Checking for texture_from_pixmap:/areturn 0' -i compiz-manager
@@ -34,7 +35,7 @@ in
 stdenv.mkDerivation rec {
 	name = "compiz-manager-"+args.version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doUnpack doReplaceScripts install doPropagate doForceShare]);
+		(textClosure localDefs [doUnpack doReplaceScripts install doPropagate doForceShare]);
 	meta = {
 		description = "
 	Compiz Launch Manager
diff --git a/pkgs/applications/window-managers/compiz-fusion/compizconfig-python/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/compizconfig-python/0.6.0.nix
index 73f1c653361c0..64247cb1b8d2f 100644
--- a/pkgs/applications/window-managers/compiz-fusion/compizconfig-python/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/compizconfig-python/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0.1/compizconfig-python-0.6.0.1.tar.bz2;
@@ -9,10 +9,11 @@ args : with args;
 			[libcompizconfig bcop python pyrex configBackendGConf];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "compizconfig-python-"+args.version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doAutotools doConfigure doMakeInstall doForceShare]);
+		(textClosure localDefs [doAutotools doConfigure doMakeInstall doForceShare]);
 	meta = {
 		description = "
 	Compiz configuration - Python part.
diff --git a/pkgs/applications/window-managers/compiz-fusion/config-backend/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/config-backend/0.6.0.nix
index 3405ae0ce97ab..12ef3bb58a03d 100644
--- a/pkgs/applications/window-managers/compiz-fusion/config-backend/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/config-backend/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0/compizconfig-backend-gconf-0.6.0.tar.bz2;
@@ -10,10 +10,11 @@ args : with args;
 		configureFlags = [];
 		forceShare = ["man" "doc" "info" "lib/compizconfig"];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "compizconfig-backend-GConf-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doAutotools doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doAutotools doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	Compiz configuration backend (GConf).
diff --git a/pkgs/applications/window-managers/compiz-fusion/extra/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/extra/0.6.0.nix
index e304eb9d6ae4d..cc6b2f215cab8 100644
--- a/pkgs/applications/window-managers/compiz-fusion/extra/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/extra/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0/compiz-fusion-plugins-extra-0.6.0.tar.bz2;
@@ -9,6 +9,7 @@ args : with args;
 		[bcop libjpeg gettext pluginsMain];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let
 	sharePlugins = FullDepEntry ("
 		ensureDir \$out/share/compiz-plugins
@@ -22,7 +23,7 @@ in
 stdenv.mkDerivation rec {
 	name = "compiz-fusion-plugins-extra-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [fixIncludes doConfigure doMakeInstall sharePlugins doForceShare]);
+		(textClosure localDefs [fixIncludes doConfigure doMakeInstall sharePlugins doForceShare]);
 	meta = {
 		description = "
 	Extra Compiz Fusion plugins.
diff --git a/pkgs/applications/window-managers/compiz-fusion/libcompizconfig/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/libcompizconfig/0.6.0.nix
index 8b5d729dc2dc4..5602c65786737 100644
--- a/pkgs/applications/window-managers/compiz-fusion/libcompizconfig/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/libcompizconfig/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0/libcompizconfig-0.6.0.tar.bz2;
@@ -9,10 +9,11 @@ args : with args;
 			[bcop];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "libcompizconfig-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doAutotools doConfigure doMakeInstall doForceShare]);
+		(textClosure localDefs [doAutotools doConfigure doMakeInstall doForceShare]);
 	meta = {
 		description = "
 	Compiz configuration backend library.
diff --git a/pkgs/applications/window-managers/compiz-fusion/main/0.6.0.nix b/pkgs/applications/window-managers/compiz-fusion/main/0.6.0.nix
index 40261da5cc4e8..deb4b2e3a5760 100644
--- a/pkgs/applications/window-managers/compiz-fusion/main/0.6.0.nix
+++ b/pkgs/applications/window-managers/compiz-fusion/main/0.6.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/0.6.0/compiz-fusion-plugins-main-0.6.0.tar.bz2;
@@ -9,6 +9,7 @@ args : with args;
 		[bcop libjpeg gettext];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let
 	sharePlugins = FullDepEntry ("
 		ensureDir \$out/share/compiz-plugins
@@ -18,7 +19,7 @@ in
 stdenv.mkDerivation rec {
 	name = "compiz-fusion-plugins-main-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall sharePlugins doForceShare]);
+		(textClosure localDefs [doConfigure doMakeInstall sharePlugins doForceShare]);
 	meta = {
 		description = "
 	Main Compiz Fusion plugins.
diff --git a/pkgs/applications/window-managers/compiz/0.6.2.nix b/pkgs/applications/window-managers/compiz/0.6.2.nix
index 6eef24beb9948..78369081bc9d6 100644
--- a/pkgs/applications/window-managers/compiz/0.6.2.nix
+++ b/pkgs/applications/window-managers/compiz/0.6.2.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://releases.compiz-fusion.org/compiz/0.6.2/compiz-0.6.2.tar.bz2;
@@ -22,6 +22,7 @@ args : with args;
 			(if args ? extraConfigureFlags then args.extraConfigureFlags else []);
 		patches = [ ./glx-patch-0.6.2.patch ];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let
 	postAll = FullDepEntry ("
     for i in $out/bin/*; do
@@ -36,7 +37,7 @@ stdenv.mkDerivation
 rec {
 	name = "compiz-0.6.2";
 	builder = writeScript (name + "-builder")
-		(textClosure [doPatch doConfigure doMakeInstall doPropagate 
+		(textClosure localDefs [doPatch doConfigure doMakeInstall doPropagate 
 			doForceShare postAll]);
 	inherit propagatedBuildInputs;
 	meta = {
diff --git a/pkgs/applications/window-managers/fbpanel/4.12.nix b/pkgs/applications/window-managers/fbpanel/4.12.nix
index 4e08102af80ae..1958ffa642bf0 100644
--- a/pkgs/applications/window-managers/fbpanel/4.12.nix
+++ b/pkgs/applications/window-managers/fbpanel/4.12.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://garr.dl.sourceforge.net/sourceforge/fbpanel/fbpanel-4.12.tgz;
@@ -10,10 +10,11 @@ args : with args;
 		  libpng libjpeg libtiff librsvg];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "fbpanel";
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	Just a desktop panel.	
diff --git a/pkgs/data/fonts/fontWrap/default.nix b/pkgs/data/fonts/fontWrap/default.nix
index ef370be8e3565..8bc120c686a93 100644
--- a/pkgs/data/fonts/fontWrap/default.nix
+++ b/pkgs/data/fonts/fontWrap/default.nix
@@ -1,9 +1,10 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src =""; /* put a fetchurl here */
 		buildInputs = [mkfontdir mkfontscale];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let
 	doInstall = FullDepEntry ("
 		ensureDir \$out/share/fonts/
@@ -18,10 +19,10 @@ in
 stdenv.mkDerivation rec {
 	name = "wrapped-font-dir";
 	builder = writeScript (name + "-builder")
-		(textClosure [ doInstall doForceShare doPropagate]);
+		(textClosure localDefs [ doInstall doForceShare doPropagate]);
 	meta = {
 		description = "
-		Just a wrapper to create fots.dir and fonts.scale .
+		Just a wrapper to create fonts.dir and fonts.scale .
 ";
 	};
 }
diff --git a/pkgs/development/compilers/qi/9.1.nix b/pkgs/development/compilers/qi/9.1.nix
index 661bb85e79894..3a1a4f37886b3 100644
--- a/pkgs/development/compilers/qi/9.1.nix
+++ b/pkgs/development/compilers/qi/9.1.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://www.lambdassociates.org/Download/Qi9.1.zip;
@@ -8,6 +8,7 @@ args : with args;
 		buildInputs = [ unzip clisp];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 	shell=stdenv.shell;
 in
@@ -28,7 +29,7 @@ in
 stdenv.mkDerivation rec {
 	name = "Qi-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [allBuild doForceShare doPropagate]);
+		(textClosure localDefs [allBuild doForceShare doPropagate]);
 	meta = {
 		description = "
 		Qi - next generation on top of Common Lisp.
diff --git a/pkgs/development/interpreters/pyrex/0.9.6.nix b/pkgs/development/interpreters/pyrex/0.9.6.nix
index 7053f949a4306..1b11e8efe36e9 100644
--- a/pkgs/development/interpreters/pyrex/0.9.6.nix
+++ b/pkgs/development/interpreters/pyrex/0.9.6.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://www.cosc.canterbury.ac.nz/greg.ewing/python/Pyrex/oldtar/Pyrex-0.9.6.tar.gz;
@@ -8,10 +8,11 @@ args : with args;
 		buildInputs = [python];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "Pyrex-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [installPythonPackage doForceShare]);
+		(textClosure localDefs [installPythonPackage doForceShare]);
 	meta = {
 		description = "
 	Python package compiler or something like that.	
diff --git a/pkgs/development/libraries/fftw/default.nix b/pkgs/development/libraries/fftw/default.nix
index 3f71254430349..3f5d13b09fb94 100644
--- a/pkgs/development/libraries/fftw/default.nix
+++ b/pkgs/development/libraries/fftw/default.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs { 
 		src = 
 			fetchurl {
 				url = ftp://ftp.fftw.org/pub/fftw/fftw-3.1.2.tar.gz;
@@ -8,10 +8,11 @@ args : with args;
 		buildInputs = [];
 		configureFlags = ["--enable-float --enable-shared"];
 	} null;
+	in with localDefs;
 stdenv.mkDerivation {
 	name = "fftw-3.1.2";
 	builder = writeScript "fftw-3.1.2-builder"
-		(textClosure [doConfigure doMakeInstall doForceShare]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare]);
 	meta = {
 		description = "
 	Fastest Fourier Transform in the West library.
diff --git a/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix b/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix
index be0db328ef943..8c3975c8da21b 100644
--- a/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix
+++ b/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 			fetchurl {
 				url = mirror://sourceforge/libdbi-drivers/libdbi-drivers-0.8.2-1.tar.gz;
@@ -27,10 +27,11 @@ args : with args;
 		] else [])
 		;
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "libdbi"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	DB independent interface to DB; DB drivers (mysql only for now).
diff --git a/pkgs/development/libraries/libdbi/0.8.2.nix b/pkgs/development/libraries/libdbi/0.8.2.nix
index e7dc24417f218..e80c0196650ae 100644
--- a/pkgs/development/libraries/libdbi/0.8.2.nix
+++ b/pkgs/development/libraries/libdbi/0.8.2.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 			fetchurl {
 				url = mirror://sourceforge/libdbi/libdbi-0.8.2.tar.gz;
@@ -9,10 +9,11 @@ args : with args;
 		buildInputs = [];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "libdbi"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	DB independent interface to DB.	
diff --git a/pkgs/development/libraries/libextractor/0.5.18.nix b/pkgs/development/libraries/libextractor/0.5.18.nix
index 3f8304d7304ae..6fc5e8524486d 100644
--- a/pkgs/development/libraries/libextractor/0.5.18.nix
+++ b/pkgs/development/libraries/libextractor/0.5.18.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://gnunet.org/libextractor/download/libextractor-0.5.18.tar.gz;
@@ -9,10 +9,11 @@ args : with args;
 		buildInputs = [ zlib];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "libextractor"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	Libextractor - extracts metadata from files.
diff --git a/pkgs/development/tools/misc/indent/2.2.9.nix b/pkgs/development/tools/misc/indent/2.2.9.nix
index d7e91abcf83bf..5e92802beed1d 100644
--- a/pkgs/development/tools/misc/indent/2.2.9.nix
+++ b/pkgs/development/tools/misc/indent/2.2.9.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = ftp://ftp.gnu.org/gnu/indent/indent-2.2.9.tar.gz;
@@ -9,6 +9,7 @@ args : with args;
 		buildInputs = [];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 	preBuild = FullDepEntry ("
 		sed -e '/extern FILE [*]output/i#ifndef OUTPUT_DEFINED_ELSEWHERE' -i src/indent.h
@@ -19,7 +20,7 @@ in
 stdenv.mkDerivation rec {
 	name = "indent";
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure preBuild doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure preBuild doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	GNU Indent - a source text formatter.
diff --git a/pkgs/development/tools/misc/intltool/0.36.2.nix b/pkgs/development/tools/misc/intltool/0.36.2.nix
index d8315a9ba62e4..884c76a800c79 100644
--- a/pkgs/development/tools/misc/intltool/0.36.2.nix
+++ b/pkgs/development/tools/misc/intltool/0.36.2.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = http://ftp.gnome.org/pub/gnome/sources/intltool/0.36/intltool-0.36.2.tar.bz2;
@@ -9,10 +9,11 @@ args : with args;
 		propagatedBuildInputs = [perl perlXMLParser];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "intltool-0.36.2";
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doPropagate doForceShare]);
+		(textClosure localDefs [doConfigure doMakeInstall doPropagate doForceShare]);
 	inherit propagatedBuildInputs;
 	meta = {
 		description = "
diff --git a/pkgs/development/tools/misc/ltrace/default.nix b/pkgs/development/tools/misc/ltrace/default.nix
index 23b44bf3b5b7f..cd77984ded6cf 100644
--- a/pkgs/development/tools/misc/ltrace/default.nix
+++ b/pkgs/development/tools/misc/ltrace/default.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 	fetchurl {
 		url = ftp://ftp.debian.org/debian/pool/main/l/ltrace/ltrace_0.5.orig.tar.gz;
@@ -12,6 +12,7 @@ args : with args;
 			cd ltrace-*;
 		";
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let
 	preConfigure = FullDepEntry ("
 		sed -e 's@-o root -g root@@' -i Makefile.in;
@@ -20,7 +21,7 @@ in
 stdenv.mkDerivation rec {
 	name = "ltrace-0.5";
 	builder = writeScript (name + "-builder")
-		(textClosure [preConfigure doConfigure doMakeInstall doForceShare]);
+		(textClosure localDefs [preConfigure doConfigure doMakeInstall doForceShare]);
 	meta = {
 		description = "
 	Library call tracer.
diff --git a/pkgs/games/construo/0.2.2.nix b/pkgs/games/construo/0.2.2.nix
index 964b0e3898e6f..555d2f4b30b95 100644
--- a/pkgs/games/construo/0.2.2.nix
+++ b/pkgs/games/construo/0.2.2.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://savannah.nongnu.org/download/construo/construo-0.2.2.tar.gz;
@@ -11,6 +11,7 @@ args : with args;
 		;
 		configureFlags = [""];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 preConfigure = FullDepEntry ("
   sed -e 's/math[.]h/cmath/' -i vector.cxx
@@ -20,7 +21,7 @@ in
 stdenv.mkDerivation rec {
 	name = "construo-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	Construo masses and springs simulation.
diff --git a/pkgs/games/fsg/alt-builder.nix b/pkgs/games/fsg/alt-builder.nix
index 8efd788789b4e..4401bf8451aca 100644
--- a/pkgs/games/fsg/alt-builder.nix
+++ b/pkgs/games/fsg/alt-builder.nix
@@ -1,13 +1,13 @@
 args: with args; 
-	with (builderDefs 
-	{ 
+	let localDefs = builderDefs {
   		buildInputs =[(wxGTK null)];
 		  src = 
 			fetchurl {
 				url = http://www.piettes.com/fallingsandgame/fsg-src-4.4.tar.gz;
 				sha256 = "1756y01rkvd3f1pkj88jqh83fqcfl2fy0c48mcq53pjzln9ycv8c";
 			};
-	} null);
+	} null;
+	in with localDefs;
 let 
 	preBuild = FullDepEntry "
 		sed -e '
@@ -25,7 +25,7 @@ in
 stdenv.mkDerivation {
   name = "fsg-4.4";
 	builder = writeScript "fsg-4.4-builder"
-		(textClosure [doUnpack addInputs preBuild doMake installPhase doForceShare]);
+		(textClosure localDefs [doUnpack addInputs preBuild doMake installPhase doForceShare]);
 
   meta = {
     description = "
diff --git a/pkgs/lib/strings-with-deps.nix b/pkgs/lib/strings-with-deps.nix
index c70c1f2728d46..4fb4fe150a7cf 100644
--- a/pkgs/lib/strings-with-deps.nix
+++ b/pkgs/lib/strings-with-deps.nix
@@ -18,7 +18,7 @@ args:
 	with lib;
 	let 
 		inherit (builtins)	
-			head tail isList;
+			head tail isList isAttrs;
 in
 rec {
 
@@ -52,12 +52,23 @@ rec {
 			(concatLists (map textClosureDupList arg.deps)) ++ [arg]
 	);
 
-	textClosureList = arg:
+	textClosureDupListOverridable = predefined: arg:
+	(
+		if isList arg then 
+			textClosureDupListOverridable predefined {text = ""; deps = arg;} 
+		else if isAttrs arg then
+			(concatLists (map (textClosureDupListOverridable predefined) arg.deps)) ++ [arg]
+		else
+			textClosureDupListOverridable predefined (getAttr [arg] [] predefined)
+	);
+
+	textClosureListOverridable = predefined: arg:
 		(map	(x : x.text) 
-			(uniqList {inputList = textClosureDupList arg;}));
-	textClosure = arg: concatStringsSep "\n" (textClosureList arg);
+			(uniqList {inputList = textClosureDupListOverridable predefined arg;}));
+	textClosureOverridable = predefined: arg: concatStringsSep "\n" (textClosureListOverridable predefined arg);
 	
-	textClosureMap = f: arg: concatStringsSep "\n" (map f (textClosureList arg));
+	textClosureMapOveridable = f: predefined: arg: 
+		concatStringsSep "\n" (map f (textClosureListOverridable predefined arg));
 
 	noDepEntry = text : {inherit text;deps = [];};
 	FullDepEntry = text : deps: {inherit text deps;};
diff --git a/pkgs/os-specific/linux/atheros/0.9.3.3.nix b/pkgs/os-specific/linux/atheros/0.9.3.3.nix
index d5c207bf18818..419c136bed236 100644
--- a/pkgs/os-specific/linux/atheros/0.9.3.3.nix
+++ b/pkgs/os-specific/linux/atheros/0.9.3.3.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://downloads.sourceforge.net/madwifi/madwifi-0.9.3.3.tar.bz2;
@@ -16,6 +16,7 @@ args : with args;
 			sha256 = "11xpx5g9w7ilagvj60prc3s8a3x0n5n4mr0b7nh0lxwrbjdgjjfg";
 		} else "")*/;
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 doPatch = FullDepEntry (if patchAR2425x86 !="" then ''
 	cd hal
@@ -25,7 +26,7 @@ in
 stdenv.mkDerivation rec {
 	name = "atheros-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doPatch doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doPatch doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		Atheros WiFi driver.
diff --git a/pkgs/os-specific/linux/atheros/r2756.nix b/pkgs/os-specific/linux/atheros/r2756.nix
index 8309b78586590..031404b0395f2 100644
--- a/pkgs/os-specific/linux/atheros/r2756.nix
+++ b/pkgs/os-specific/linux/atheros/r2756.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://snapshots.madwifi.org/madwifi-ng/madwifi-ng-r2756-20071018.tar.gz;
@@ -16,6 +16,7 @@ args : with args;
 			sha256 = "11xpx5g9w7ilagvj60prc3s8a3x0n5n4mr0b7nh0lxwrbjdgjjfg";
 		} else "");
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 doPatch = FullDepEntry (if patchAR2425x86 !="" then ''
 	cd hal
@@ -26,7 +27,7 @@ in
 stdenv.mkDerivation rec {
 	name = "atheros-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doPatch doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doPatch doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		Atheros WiFi driver.
diff --git a/pkgs/os-specific/linux/atheros/r3122.nix b/pkgs/os-specific/linux/atheros/r3122.nix
index c82b4021544a2..e9fb7bab01a48 100644
--- a/pkgs/os-specific/linux/atheros/r3122.nix
+++ b/pkgs/os-specific/linux/atheros/r3122.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://snapshots.madwifi.org/madwifi-ng/madwifi-ng-r3122-20080109.tar.gz;
@@ -10,10 +10,11 @@ args : with args;
 		configureFlags = [];
 		makeFlags = [''KERNELPATH=${kernel}/lib/modules/*/build'' ''DESTDIR=$out''];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "atheros-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		Atheros WiFi driver.
diff --git a/pkgs/os-specific/linux/dmidecode/2.9.nix b/pkgs/os-specific/linux/dmidecode/2.9.nix
index 787846465d849..968ab80a4aff4 100644
--- a/pkgs/os-specific/linux/dmidecode/2.9.nix
+++ b/pkgs/os-specific/linux/dmidecode/2.9.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://download.savannah.gnu.org/releases/dmidecode/dmidecode-2.9.tar.bz2;
@@ -10,10 +10,11 @@ args : with args;
 		configureFlags = [];
 		makeFlags = "prefix=\$out";
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "dmidecode-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [ doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [ doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		Tool to decode Desktop Management Interface and SBIOS data.
diff --git a/pkgs/os-specific/linux/dvd+rw-tools/7.0.nix b/pkgs/os-specific/linux/dvd+rw-tools/7.0.nix
index c991389633ca6..658bdbf55fa28 100644
--- a/pkgs/os-specific/linux/dvd+rw-tools/7.0.nix
+++ b/pkgs/os-specific/linux/dvd+rw-tools/7.0.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://fy.chalmers.se/~appro/linux/DVD+RW/tools/dvd+rw-tools-7.0.tar.gz;
@@ -10,6 +10,7 @@ args : with args;
 		configureFlags = [];
 		makeFlags = [" prefix=\$out "];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 	preBuild = FullDepEntry ("
 		sed -e 's@/usr/local@'\$out'@g' -i Makefile.m4 Makefile
@@ -18,7 +19,7 @@ in
 stdenv.mkDerivation rec {
 	name = "dvd+rw-tools-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [preBuild doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [preBuild doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	DVD+RW tools.
diff --git a/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix b/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix
index 3aa2731ac3fb4..cb3aa90444c17 100644
--- a/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix
+++ b/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://fabrice.bellard.free.fr/qemu/kqemu-1.3.0pre11.tar.gz;
@@ -8,6 +8,7 @@ args : with args;
 		buildInputs = [];
 		configureFlags = [''--prefix=$out'' ''--kernel-path=$(ls -d ${kernel}/lib/modules/*/build)''];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
   debugStep = FullDepEntry (''
   	cat config-host.mak
@@ -21,7 +22,7 @@ in
 stdenv.mkDerivation rec {
 	name = "kqemu-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [preConfigure doConfigure debugStep doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [preConfigure doConfigure debugStep doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 		Kernel module for Qemu acceleration
diff --git a/pkgs/os-specific/linux/module-init-tools/aggregator.nix b/pkgs/os-specific/linux/module-init-tools/aggregator.nix
index cfd49cc0813f0..98c45d7391f9f 100644
--- a/pkgs/os-specific/linux/module-init-tools/aggregator.nix
+++ b/pkgs/os-specific/linux/module-init-tools/aggregator.nix
@@ -1,10 +1,11 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		addSbinPath = true;
 		src = "";
 		buildInputs = [module_init_tools];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let 
 
 doCollect = FullDepEntry (''
@@ -25,7 +26,7 @@ stdenv.mkDerivation rec {
 	name = "kernel-modules";
 	inherit moduleSources;
 	builder = writeScript (name + "-builder")
-		(textClosure [doCollect doForceShare doPropagate]);
+		(textClosure localDefs [doCollect doForceShare doPropagate]);
 	meta = {
 		description = "
 		A directory to hold all  the modules, including those 
diff --git a/pkgs/os-specific/linux/sdparm/1.02.nix b/pkgs/os-specific/linux/sdparm/1.02.nix
index 0616ac83563b8..edff04444e061 100644
--- a/pkgs/os-specific/linux/sdparm/1.02.nix
+++ b/pkgs/os-specific/linux/sdparm/1.02.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://sg.torque.net/sg/p/sdparm-1.02.tgz;
@@ -9,10 +9,11 @@ args : with args;
 		buildInputs = [];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "sdparm-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	SCSI parameters utility.
diff --git a/pkgs/tools/misc/relfs/cvs.2007.12.01.nix b/pkgs/tools/misc/relfs/cvs.2007.12.01.nix
index adaa5d11cfc95..08d2d6f2ebe3d 100644
--- a/pkgs/tools/misc/relfs/cvs.2007.12.01.nix
+++ b/pkgs/tools/misc/relfs/cvs.2007.12.01.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 	src = /* put a fetchurl here */
 	fetchcvs {
 		url = ":pserver:anonymous@relfs.cvs.sourceforge.net:/cvsroot/relfs";
@@ -12,6 +12,7 @@ args : with args;
 			e2fsprogs gnomevfs pkgconfig GConf];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 let build = FullDepEntry ("
 	cd deps 
 	sed -e 's/^CPP/#&/ ; s/^# CPP=gcc/CPP=gcc/' -i Makefile.camlidl
@@ -41,7 +42,7 @@ in
 stdenv.mkDerivation rec {
 	name = "relfs-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [build doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [build doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	Relational FS over FUSE.
diff --git a/pkgs/tools/system/gdmap/0.7.5.nix b/pkgs/tools/system/gdmap/0.7.5.nix
index 354ebb966a1c8..062f63566a6b4 100644
--- a/pkgs/tools/system/gdmap/0.7.5.nix
+++ b/pkgs/tools/system/gdmap/0.7.5.nix
@@ -1,5 +1,5 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 		fetchurl {
 			url = http://dfn.dl.sourceforge.net/sourceforge/gdmap/gdmap-0.7.5.tar.gz;
@@ -9,10 +9,11 @@ args : with args;
 		buildInputs = [gtk pkgconfig libxml2 intltool];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "gdmap"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [doConfigure doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	Recursive rectangle map of disk usage.	
diff --git a/pkgs/top-level/builder-defs.nix b/pkgs/top-level/builder-defs.nix
index aa53c9ba15750..a2b132ee3657a 100644
--- a/pkgs/top-level/builder-defs.nix
+++ b/pkgs/top-level/builder-defs.nix
@@ -40,7 +40,7 @@ args: with args; with stringsWithDeps; with lib;
 		{
 			addToSearchPathWithCustomDelimiter \"\${PATH_DELIMITER}\" \"\$@\"
 		}
-	") [defNest];
+	") ["defNest"];
 
 	defNest = noDepEntry ("
 		nestingLevel=0
@@ -95,7 +95,7 @@ args: with args; with stringsWithDeps; with lib;
 		prefix=${if args ? prefix then (toString args.prefix) else "\$out"}
 
 		"
-	else "")) [defNest defAddToSearchPath];
+	else "")) ["defNest" "defAddToSearchPath"];
 		
 	addInputs = FullDepEntry ("
 		# Recursively find all build inputs.
@@ -161,7 +161,7 @@ args: with args; with stringsWithDeps; with lib;
 		fi
 
 		PATH=\$_PATH\${_PATH:+:}\$PATH
-	") [minInit];
+	") ["minInit"];
 	
 	defEnsureDir = FullDepEntry ("
 		# Ensure that the given directories exists.
@@ -171,7 +171,7 @@ args: with args; with stringsWithDeps; with lib;
 			if ! test -x \"\$dir\"; then mkdir -p \"\$dir\"; fi
 		    done
 		}
-	") [minInit];
+	") ["minInit"];
 
 	toSrcDir = s : FullDepEntry ((if (archiveType s) == "tar" then "
 		tar xvf '${s}'
@@ -200,11 +200,11 @@ args: with args; with stringsWithDeps; with lib;
 		cd \$(basename ${s} .bz2)
 	" else (abort "unknown archive type : ${s}"))+
 		(if args ? goSrcDir then args.goSrcDir else "")
-	) [minInit];
+	) ["minInit"];
 
 	doConfigure = FullDepEntry ("
 		./configure --prefix=\"\$prefix\" ${toString configureFlags}
-	") [minInit addInputs doUnpack];
+	") ["minInit" "addInputs" "doUnpack"];
 
 	doAutotools = FullDepEntry ("
 		mkdir -p config
@@ -214,21 +214,21 @@ args: with args; with stringsWithDeps; with lib;
 		autoheader || true; 
 		automake --add-missing --copy
 		autoconf
-	")[minInit addInputs doUnpack];
+	")["minInit" "addInputs" "doUnpack"];
 
 	doMake = FullDepEntry ("	
 		make ${toString makeFlags}
-	") [minInit addInputs doUnpack];
+	") ["minInit" "addInputs" "doUnpack"];
 
 	doUnpack = toSrcDir (toString src);
 
 	installPythonPackage = FullDepEntry ("
 		python setup.py install --prefix=\"\$prefix\" 
-		") [minInit addInputs doUnpack];
+		") ["minInit" "addInputs" "doUnpack"];
 
 	doMakeInstall = FullDepEntry ("
 		make ${toString (getAttr ["makeFlags"] "" args)} "+
-			"${toString (getAttr ["installFlags"] "" args)} install") [doMake];
+			"${toString (getAttr ["installFlags"] "" args)} install") ["doMake"];
 
 	doForceShare = FullDepEntry (" 
 		ensureDir \"\$prefix/share\"
@@ -238,7 +238,7 @@ args: with args; with stringsWithDeps; with lib;
 				ln -sv share/\$d \"\$prefix\"
 			fi;
 		done;
-	") [minInit defEnsureDir];
+	") ["minInit" "defEnsureDir"];
 
 	doDump = n: noDepEntry "echo Dump number ${n}; set";
 
@@ -250,7 +250,7 @@ args: with args; with stringsWithDeps; with lib;
 
 	doPatch = FullDepEntry (concatStringsSep ";"
 		(map toPatchCommand patches)
-	) [minInit doUnpack];
+	) ["minInit" "doUnpack"];
 
 	envAdderInner = s: x: if x==null then s else y: 
 		a: envAdderInner (s+"echo export ${x}='\"'\"\$${x}:${y}\";'\"'\n") a;
@@ -268,12 +268,12 @@ args: with args; with stringsWithDeps; with lib;
 		(${envAdderList env}
 		echo '\"'\"${cmd}-orig\"'\"' '\"'\\\$@'\"' \n)  > \"${cmd}\"";
 
-	doWrap = cmd: FullDepEntry (wrapEnv cmd (getAttr ["wrappedEnv"] [] args)) [minInit];
+	doWrap = cmd: FullDepEntry (wrapEnv cmd (getAttr ["wrappedEnv"] [] args)) ["minInit"];
 
 	doPropagate = FullDepEntry ("
 		ensureDir \$out/nix-support
 		echo '${toString (getAttr ["propagatedBuildInputs"] [] args)}' >\$out/nix-support/propagated-build-inputs
-	") [minInit defEnsureDir];
+	") ["minInit" "defEnsureDir"];
 
 	/*debug = x:(__trace x x);
 	debugX = x:(__trace (__toXML x) x);*/
@@ -283,7 +283,7 @@ args: with args; with stringsWithDeps; with lib;
 	replaceScripts = l:(concatStringsSep "\n" (pairMap replaceInScript l));
 	doReplaceScripts = FullDepEntry (replaceScripts (getAttr ["shellReplacements"] [] args)) [minInit];
 	makeNest = x:(if x==defNest.text then x else "startNest\n" + x + "\nstopNest\n");
-	textClosure = textClosureMap makeNest;
+	textClosure = textClosureMapOveridable makeNest;
 
 	inherit noDepEntry FullDepEntry PackEntry;
 
diff --git a/pkgs/top-level/template-composing+config.nix b/pkgs/top-level/template-composing+config.nix
index df751f693f238..7ff4f3f9d5024 100644
--- a/pkgs/top-level/template-composing+config.nix
+++ b/pkgs/top-level/template-composing+config.nix
@@ -1,4 +1,4 @@
-args : with args; with builderDefs (args // {
+args : with args; let localDefs = builderDefs (args // {
 		src = /* put a fetchurl here */
 		(abort "Specify source");
 		useConfig = true;
@@ -10,10 +10,11 @@ args : with args; with builderDefs (args // {
 		configFlags = [
 		];
 	}) null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
 	name = "${(abort "Specify name")}"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [(abort "Check phases") doMakeInstall doForceShare doPropagate]);
+		(textClosure localDefs [(abort "Check phases") doMakeInstall doForceShare doPropagate]);
 	meta = {
 		description = "
 	${(abort "Specify description")}
diff --git a/pkgs/top-level/template-composing-builder.nix b/pkgs/top-level/template-composing-builder.nix
index 8117b156879b1..1175d5992331f 100644
--- a/pkgs/top-level/template-composing-builder.nix
+++ b/pkgs/top-level/template-composing-builder.nix
@@ -1,14 +1,16 @@
 args : with args;
-	with builderDefs {
+	let localDefs = builderDefs {
 		src = /* put a fetchurl here */
 
 		buildInputs = [];
 		configureFlags = [];
 	} null; /* null is a terminator for sumArgs */
+	in with localDefs;
 stdenv.mkDerivation rec {
-	name = "${abort "Specify name"}";
+	name = "${abort "Specify name"}-"+version;
 	builder = writeScript (name + "-builder")
-		(textClosure [(abort "Specify phases - defined here or in builderDefs") doForceShare doPropagate]);
+		(textClosure localDefs 
+			[(abort "Specify phases - defined here or in builderDefs") doForceShare doPropagate]);
 	meta = {
 		description = "
 		${abort "Write a description"}