about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2008-12-20 01:20:35 +0000
committerMarc Weber <marco-oweber@gmx.de>2008-12-20 01:20:35 +0000
commite996113be7f41f067aaefac881c540b5ceb8d2d4 (patch)
tree177f16552ca2d05020c3d45a0b45502556a09502 /pkgs
parent5ab6464edb9bbc2a9aa15122ffc02b57ad236bb7 (diff)
removed mkDerivationByConfiguration, using composableDerivation instead
qgis, vim_configurable both work now

svn path=/nixpkgs/trunk/; revision=13661
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/editors/vim/configurable.nix130
-rw-r--r--pkgs/applications/misc/audio/sox/default.nix81
-rw-r--r--pkgs/applications/misc/mrxvt/default.nix19
-rw-r--r--pkgs/applications/misc/qgis/0.11.0.nix45
-rw-r--r--pkgs/applications/misc/qgis_svn/default.nix74
-rw-r--r--pkgs/applications/video/MPlayer/newconfig.nix255
-rw-r--r--pkgs/development/compilers/bigloo/default.nix4
-rw-r--r--pkgs/development/compilers/hugs/default.nix101
-rw-r--r--pkgs/development/compilers/roadsend/default.nix54
-rw-r--r--pkgs/development/interpreters/php_configurable/default.nix199
-rw-r--r--pkgs/development/libraries/fltk/default.nix60
-rw-r--r--pkgs/development/libraries/geos/default.nix66
-rw-r--r--pkgs/development/libraries/libdv/default.nix37
-rw-r--r--pkgs/development/libraries/libsamplerate/default.nix54
-rw-r--r--pkgs/development/tools/misc/avrdude/default.nix48
-rw-r--r--pkgs/lib/composable-derivation.nix46
-rw-r--r--pkgs/lib/default.nix246
-rw-r--r--pkgs/misc/gxemul/default.nix55
-rw-r--r--pkgs/misc/jackaudio/default.nix104
-rw-r--r--pkgs/servers/squid/3.head.nix24
-rw-r--r--pkgs/servers/squid/default.nix33
-rw-r--r--pkgs/top-level/all-packages.nix116
22 files changed, 641 insertions, 1210 deletions
diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix
index b27bb157f75ad..0eac7ea5979f4 100644
--- a/pkgs/applications/editors/vim/configurable.nix
+++ b/pkgs/applications/editors/vim/configurable.nix
@@ -1,72 +1,78 @@
 # TODO tidy up eg The patchelf code is patching gvim even if you don't build it..
 # but I have gvim with python support now :) - Marc
-args:
-let edf = args.lib.enableDisableFeature; in
-( args.mkDerivationByConfiguration {
-    # most interpreters aren't tested yet.. (see python for example how to do it)
-    flagConfig = { 
-      mandatory = { cfgOption = "--enable-gui=auto --with-features=${args.features}"; 
-                    buildInputs = ["ncurses" "pkgconfig"];
-                  };
-      X11 = { buildInputs = [ "libX11" "libXext" "libSM" "libXpm" "libXt" "libXaw" "libXau" "libXmu" ]; };
+args: with args;
+let inherit (args.composableDerivation) composableDerivation edf; in
+composableDerivation {
+  initial = {
 
-    } // edf "darwin" "darwin" { } #Disable Darwin (Mac OS X) support.
-      // edf "xsmp" "xsmp" { } #Disable XSMP session management
-      // edf "xsmp_interact" "xsmp_interact" {  } #Disable XSMP interaction
-      // edf "mzscheme" "mzschemeinterp" { } #Include MzScheme interpreter.
-      // edf "perl" "perlinterp" { } #Include Perl interpreter.
-      // edf "python" "pythoninterp" { pass = "python"; } #Include Python interpreter.
-      // edf "tcl" "tclinterp" { } #Include Tcl interpreter.
-      // edf "ruby" "rubyinterp" { } #Include Ruby interpreter.
-      // edf "cscope" "cscope" { } #Include cscope interface.
-      // edf "workshop" "workshop" { } #Include Sun Visual Workshop support.
-      // edf "netbeans" "netbeans" { } #Disable NetBeans integration support.
-      // edf "sniff" "sniff" { } #Include Sniff interface.
-      // edf "multibyte" "multibyte" { } #Include multibyte editing support.
-      // edf "hangulinput" "hangulinput" { } #Include Hangul input support.
-      // edf "xim" "xim" { pass = "xim"; } #Include XIM input support.
-      // edf "fontset" "fontset" { } #Include X fontset output support.
+      name = "vim_configurable-7.1";
 
-  #--enable-gui=OPTS     X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon
-    /*
-      // edf "gtk_check" "gtk_check" { } #If auto-select GUI, check for GTK default=yes
-      // edf "gtk2_check" "gtk2_check" { } #If GTK GUI, check for GTK+ 2 default=yes
-      // edf "gnome_check" "gnome_check" { } #If GTK GUI, check for GNOME default=no
-      // edf "motif_check" "motif_check" { } #If auto-select GUI, check for Motif default=yes
-      // edf "athena_check" "athena_check" { } #If auto-select GUI, check for Athena default=yes
-      // edf "nextaw_check" "nextaw_check" { } #If auto-select GUI, check for neXtaw default=yes
-      // edf "carbon_check" "carbon_check" { } #If auto-select GUI, check for Carbon default=yes
-      // edf "gtktest" "gtktest" { } #Do not try to compile and run a test GTK program
-    */
-      // edf "acl" "acl" { } #Don't check for ACL support.
-      // edf "gpm" "gpm" { } #Don't use gpm (Linux mouse daemon).
-      // edf "nls" "nls" { } #Don't support NLS (gettext()).
-    ; 
+      src = args.fetchurl {
+        url = ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2;
+        sha256 = "11hxkb6r2550c4n13nwr0d8afvh30qjyr5c2hw16zgay43rb0kci";
+      };
 
-  optionals = ["python"];
+      cfgOption = "--enable-gui=auto --with-features=${args.features}";
 
-  extraAttrs = co : {
-    name = "vim_configurable-7.1";
+      buildInputs = [ncurses pkgconfig]
+        ++ [ libX11 libXext libSM libXpm libXt libXaw libXau libXmu ];
 
-  src = args.fetchurl {
-    url = ftp://ftp.nluug.nl/pub/editors/vim/unix/vim-7.1.tar.bz2;
-    sha256 = "0w6gy49gdbw7hby5rjkjpa7cdvc0z5iajsm4j1h8108rvfam22kz";
-  };
+      # most interpreters aren't tested yet.. (see python for example how to do it)
+      flags = {}
+        // edf { name = "darwin"; } #Disable Darwin (Mac OS X) support.
+        // edf { name = "xsmp"; } #Disable XSMP session management
+        // edf { name = "xsmp_interact"; } #Disable XSMP interaction
+        // edf { name = "mzscheme"; } #Include MzScheme interpreter.
+        // edf { name = "perl"; } #Include Perl interpreter.
+        // edf { name = "python"; feat = "pythoninterp"; enable = { buildInputs = [python]; }; } #Include Python interpreter.
+        // edf { name = "tcl"; } #Include Tcl interpreter.
+        // edf { name = "ruby"; } #Include Ruby interpreter.
+        // edf { name = "cscope"; } #Include cscope interface.
+        // edf { name = "workshop"; } #Include Sun Visual Workshop support.
+        // edf { name = "netbeans"; } #Disable NetBeans integration support.
+        // edf { name = "sniff"; } #Include Sniff interface.
+        // edf { name = "multibyte"; } #Include multibyte editing support.
+        // edf { name = "hangulinput"; } #Include Hangul input support.
+        # // edf { name = "xim"; enable = { buildInputs = [xim]; }; } #Include XIM input support.
+        // edf { name = "fontset"; } #Include X fontset output support.
+        // edf { name = "acl"; } #Don't check for ACL support.
+        // edf { name = "gpm"; } #Don't use gpm (Linux mouse daemon).
+        // edf { name = "nls"; } #Don't support NLS (gettext()).
+        ;
+
+    cfg = {
+      pythonSupport = true;
+    };
+
+    #--enable-gui=OPTS     X11 GUI default=auto OPTS=auto/no/gtk/gtk2/gnome/gnome2/motif/athena/neXtaw/photon/carbon
+      /*
+        // edf "gtk_check" "gtk_check" { } #If auto-select GUI, check for GTK default=yes
+        // edf "gtk2_check" "gtk2_check" { } #If GTK GUI, check for GTK+ 2 default=yes
+        // edf "gnome_check" "gnome_check" { } #If GTK GUI, check for GNOME default=no
+        // edf "motif_check" "motif_check" { } #If auto-select GUI, check for Motif default=yes
+        // edf "athena_check" "athena_check" { } #If auto-select GUI, check for Athena default=yes
+        // edf "nextaw_check" "nextaw_check" { } #If auto-select GUI, check for neXtaw default=yes
+        // edf "carbon_check" "carbon_check" { } #If auto-select GUI, check for Carbon default=yes
+        // edf "gtktest" "gtktest" { } #Do not try to compile and run a test GTK program
+      */
 
-  postInstall = "
-    rpath=`patchelf --print-rpath \$out/bin/vim`;
-    for i in $\buildInputs; do
-      echo adding \$i/lib
-      rpath=\$rpath:\$i/lib
-    done
-    echo \$buildInputs
-    echo \$rpath
-    patchelf --set-rpath \$rpath \$out/bin/{vim,gvim}
-  ";
+    postInstall = "
+      rpath=`patchelf --print-rpath \$out/bin/vim`;
+      for i in $\buildInputs; do
+        echo adding \$i/lib
+        rpath=\$rpath:\$i/lib
+      done
+      echo \$buildInputs
+      echo \$rpath
+      patchelf --set-rpath \$rpath \$out/bin/{vim,gvim}
+    ";
+    dontStrip =1;
+
+    meta = {
+      description = "The most popular clone of the VI editor";
+      homepage = "www.vim.org";
+    };
 
-  meta = {
-    description = "The most popular clone of the VI editor";
-    homepage = "www.vim.org";
   };
-};
-} ) args
+
+}
diff --git a/pkgs/applications/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix
index c0cf9d91b7303..1655457b40491 100644
--- a/pkgs/applications/misc/audio/sox/default.nix
+++ b/pkgs/applications/misc/audio/sox/default.nix
@@ -1,43 +1,9 @@
-args:
-( args.mkDerivationByConfiguration {
-    flagConfig = {
-    mandatory = { implies = [ "no_oss" "no_sun_audio" ]; };
-    # are these options of interest? We'll see
-    #--disable-fftw          disable usage of FFTW
-    #--enable-debug          enable debugging
-    #--disable-cpu-clip      disable tricky cpu specific clipper
-    alsa =              { cfgOption = "--enable-alsa"; buildInputs = "alsa"; };
-    no_alsa = { cfgOption = "--disable-alsa"; };
-    libao =             { cfgOption = "--enable-libao"; buildInputs = "libao"; };
-    no_libao = { cfgOption = "--disable-libao"; };
-    #oss =               { cfgOption = "--enable-oss"; buildInputs = "oss"; };
-    no_oss = { cfgOption = "--disable-oss"; };
-    #sun_audio =         { cfgOption = "--enable-sun-audio"; buildInputs = "sun_audio"; };
-    no_sun_audio = { cfgOption = "--disable-sun_audio"; };
-
-    # These options should be autodetected by the configure script 
-    /*
-    --without-sndfile       Don't try to use libsndfile
-    --without-ogg           Don't try to use Ogg Vorbis
-    --without-flac          Don't try to use FLAC
-    --without-ffmpeg        Don't try to use ffmpeg
-    --without-mad           Don't try to use MAD (MP3 Audio Decoder)
-    --without-lame          Don't try to use LAME (LAME Ain't an MP3 Encoder)
-    --without-amr-wb        Don't try to use amr-wb
-    --without-amr-nb        Don't try to use amr-nb
-    --without-samplerate    Don't try to use libsamplerate (aka Secret Rabbit
-                            Code)
-    --without-ladspa        Don't try to use LADSPA
-    --with-ladspa-path      Default search path for LADSPA plugins
-    */
-  };
-
-  optionals = [ "libsndfile" "libogg" "flac" "ffmpeg" "libmad" "lame" 
-                 /* "amr-wb" "amr-nb" */ 
-                "libsamplerate" /* "ladspa" */ ];
+args: with args;
+let inherit (args.composableDerivation) composableDerivation edf; in
+composableDerivation {
 
+  initial = {
 
-    extraAttrs = co : {
       name = "sox-14.0.0";
 
       src = args.fetchurl {
@@ -45,6 +11,43 @@ args:
         sha256 = "1l7v04nlvb96y0w9crvm6nq8g50yxp3bkv6nb1c205s982inlalc";
       };
 
+      flags =
+      # are these options of interest? We'll see
+      #--disable-fftw          disable usage of FFTW
+      #--enable-debug          enable debugging
+      #--disable-cpu-clip      disable tricky cpu specific clipper
+      edf { name = "alsa"; enable = { buildInputs = [alsaLib]; }; }
+      // edf { name = "libao"; enable = { buildInputs = [libao]; }; }
+      // edf { name = "oss"; }
+      // edf { name = "sun_audio"; };
+      # These options should be autodetected by the configure script
+      /*
+      --without-sndfile       Don't try to use libsndfile
+      --without-ogg           Don't try to use Ogg Vorbis
+      --without-flac          Don't try to use FLAC
+      --without-ffmpeg        Don't try to use ffmpeg
+      --without-mad           Don't try to use MAD (MP3 Audio Decoder)
+      --without-lame          Don't try to use LAME (LAME Ain't an MP3 Encoder)
+      --without-amr-wb        Don't try to use amr-wb
+      --without-amr-nb        Don't try to use amr-nb
+      --without-samplerate    Don't try to use libsamplerate (aka Secret Rabbit
+                              Code)
+      --without-ladspa        Don't try to use LADSPA
+      --with-ladspa-path      Default search path for LADSPA plugins
+      */
+
+
+    cfg = {
+      ossSupport = false;
+      sun_audioSupport = false;
+    };
+
+
+    optionals = [ "libsndfile" "libogg" "flac" "ffmpeg" "libmad" "lame"
+                   /* "amr-wb" "amr-nb" */
+                  "libsamplerate" /* "ladspa" */ ];
+
+
     meta = {
       description = "Sample Rate Converter for audio";
       homepage = http://www.mega-nerd.com/SRC/index.html;
@@ -55,4 +58,4 @@ args:
                   } ];
     };
   };
-} ) args
+}
diff --git a/pkgs/applications/misc/mrxvt/default.nix b/pkgs/applications/misc/mrxvt/default.nix
index f58fff56bc084..346ae2b50cd4a 100644
--- a/pkgs/applications/misc/mrxvt/default.nix
+++ b/pkgs/applications/misc/mrxvt/default.nix
@@ -1,26 +1,17 @@
-args: with args.lib; with args;
+args: with args;
+stdenv.mkDerivation {
 
-let
-  co = chooseOptionsByFlags {
-    inherit args;
-    flagDescr = {
-      mandatory = { buildInputs = [ "libX11" ]; cfgOption = "--with-x"; };
-      # many options to add here ... :)
-      # many of them can be set by configuration file I think..
-    };
-};
+  name = "mrxvt-0.5.3";
 
-in stdenv.mkDerivation {
+  buildInputs = [libX11];
 
-  inherit (co) buildInputs configureFlags;
+  configureFlags="--with-x";
 
   src = fetchurl {
     url = mirror://sourceforge/materm/mrxvt-0.5.3.tar.gz;
     sha256 = "04flnn58hp4qvvk6jzyipsj13v1qyrjabgbw5laz5cqxvxzpncp2";
   };
 
-  name = "mrxvt-0.5.3";
-
   meta = { 
     description = "multitabbed lightweight terminal emulator basd on rxvt supporting transparency, backgroundimages, freetype fonts,..";
     homepage = http://sourceforge.net/projects/materm;
diff --git a/pkgs/applications/misc/qgis/0.11.0.nix b/pkgs/applications/misc/qgis/0.11.0.nix
new file mode 100644
index 0000000000000..127675b358d5c
--- /dev/null
+++ b/pkgs/applications/misc/qgis/0.11.0.nix
@@ -0,0 +1,45 @@
+args: with args;
+let edf = composableDerivation.edf;
+    optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${__getAttr attr args}/incclude"
+                               + " -D${name}_LIBRARY=${__getAttr attr args}/lib "; # lib 64?
+in
+composableDerivation.composableDerivation {
+  initial = {
+
+    buildInputs = [ gdal cmake qt flex bison proj geos x11 sqlite gsl];
+      cfgOption = [
+                    # without this option it can't find sqlite libs yet (missing symbols..) (TODO)
+                    "-DWITH_INTERNAL_SQLITE3=TRUE"
+                  ];
+
+    name = "qgis-${version}";
+
+    # src = args.fetchsvn { url=https://svn.qgis.org/repos/qgis/trunk/qgis;
+    #                md5="ac0560e0a2d4e6258c8639f1e9b56df3"; rev="7704"; };
+    src = fetchurl {
+      url = "http://download.osgeo.org/qgis/src/qgis_${version}.tar.gz";
+      sha256 = "17vqbld4wr9jyn1s5n0bkpaminsgc2dzcgdfk8ic168xydnwa7b3";
+    };
+
+    meta = {
+      description = "user friendly Open Source Geographic Information System";
+      homepage = http://www.qgis.org;
+      # you can choose one of the following licenses:
+      license = [ "GPL" ];
+    };
+
+    phases = "unpackPhase buildPhase installPhase";
+    buildPhase = ''pwd;echo XXXXXXXXX; VERBOSE=1 cmake -DCMAKE_INSTALL_PREFIX=$out ''${cfgOption} ..'';
+
+    postUnpack = ''
+      export CMAKE_SYSTEM_LIBRARY_PATH=
+      for i in $buildInputs $propagatedBuildInputs; do
+        CMAKE_SYSTEM_LIBRARY_PATH=$i/lib:$CMAKE_SYSTEM_LIBRARY_PATH
+      done
+    '';
+
+    #configurePhase="./autogen.sh --prefix=\$out --with-gdal=\$gdal/bin/gdal-config --with-qtdir=\$qt";
+    # buildPhases="unpackPhase buildPhase";
+
+  };
+}
diff --git a/pkgs/applications/misc/qgis_svn/default.nix b/pkgs/applications/misc/qgis_svn/default.nix
deleted file mode 100644
index 547e941ecac8f..0000000000000
--- a/pkgs/applications/misc/qgis_svn/default.nix
+++ /dev/null
@@ -1,74 +0,0 @@
-args:
-let optionIncLib = name : attr : " -D${name}_INCLUDE_DIR=${__getAttr attr args}/inc"
-                               + " -D${name}_LIBRARY=${__getAttr attr args}/lib "; # lib 64?
-in
-( args.mkDerivationByConfiguration {
-
-    flagConfig = {
-      mandatory = { 
-        buildInputs = [ "gdal" "cmake" "qt" "flex" "bison" "proj" "geos" "x11" "sqlite" "gsl"]; 
-        cfgOption = [ (optionIncLib "GEOS" "geos") 
-                         (optionIncLib "PROJ" "proj")
-                         (optionIncLib "QT_X11_X11" "qt")
-                         (optionIncLib "QT_X11_Xext" "qt")
-                         (optionIncLib "QT_X11_m" "glibc")
-                         (optionIncLib "SQLITE3" "sqlite")
-
-"-DQT_FONTCONFIG_LIBRARY=${args.fontconfig}/lib"
-"-DQT_FREETYPE_LIBRARY=${args.freetype}/lib"
-"-DQT_PNG_LIBRARY=${args.libpng}/lib"
-"-DQT_X11_ICE_LIBRARY=${args.libICE}/lib"
-"-DQT_X11_SM_LIBRARY=${args.libSM}/lib"
-"-DQT_XCURSOR_LIBRARY=${args.libXcursor}/lib"
-"-DQT_XINERAMA_LIBRARY=${args.libXinerama}/lib"
-"-DQT_XRANDR_LIBRARY=${args.libXrandr}/lib"
-"-DQT_XRENDER_LIBRARY=${args.libXrender}/lib"
-"-DQT_ZLIB_LIBRARY=${args.zlib}/lib"
-                         ];
-
-/* advanced options - feel free to add them if you have time to
-"-DPROJ_INCLUDE_DIR"
-"-DPROJ_LIBRARY"
-"-DQT_X11_X11_LIBRARY"
-"-DQT_X11_Xext_LIBRARY"
-"-DQT_X11_m_LIBRARY"
-"-DSQLITE3_INCLUDE_DIR"
-"-DSQLITE3_LIBRARY"
--DQT_FONTCONFIG_LIBRARY (ADVANCED)
--DQT_FREETYPE_LIBRARY (ADVANCED)
--DQT_PNG_LIBRARY (ADVANCED)
--DQT_X11_ICE_LIBRARY (ADVANCED)
--DQT_X11_SM_LIBRARY (ADVANCED)
--DQT_XCURSOR_LIBRARY (ADVANCED)
--DQT_XINERAMA_LIBRARY (ADVANCED)
--DQT_XRANDR_LIBRARY (ADVANCED)
--DQT_XRENDER_LIBRARY (ADVANCED)
--DQT_ZLIB_LIBRARY (ADVANCED)
-*/
-      };
-    }; 
-
-    #inherit geos proj x11 libXext;
-
-    extraAttrs = co : {
-
-    name = "qgis-svn";
-
-    src = args.fetchsvn { url=https://svn.qgis.org/repos/qgis/trunk/qgis; 
-                    md5="ac0560e0a2d4e6258c8639f1e9b56df3"; rev="7704"; };
-
-    meta = { 
-      description = "user friendly Open Source Geographic Information System";
-      homepage = http://www.qgis.org;
-      # you can choose one of the following licenses: 
-      license = [ "GPL" ];
-    };
-
-    phases = "unpackPhase buildPhase installPhase";
-    buildPhase = "cmake -DCMAKE_INSTALL_PREFIX=\$out ${co.configureFlags} .";
-
-    #configurePhase="./autogen.sh --prefix=\$out --with-gdal=\$gdal/bin/gdal-config --with-qtdir=\$qt";
-    # buildPhases="unpackPhase buildPhase";
-  };
-
-} ) args
diff --git a/pkgs/applications/video/MPlayer/newconfig.nix b/pkgs/applications/video/MPlayer/newconfig.nix
deleted file mode 100644
index 323619e003295..0000000000000
--- a/pkgs/applications/video/MPlayer/newconfig.nix
+++ /dev/null
@@ -1,255 +0,0 @@
-# this nix expression is not well tested (experimental!)
-args: with args.lib; with args;
-let
-  win32codecs = (import ./win32codecs) {
-    inherit stdenv fetchurl;
-  };
-  co = chooseOptionsByFlags {
-    inherit args;
-    flagConfig = {
-      # FIXME: we only have to pass X11 if we want to use a X11 driver 
-      mandatory = { buildInputs = [ "x11" "libX11" "freetype" "zlib" ]; };
-
-      # FIXME this options are still a mess.. :) feel free to test and implement the missing ones
-
-      # Optional features
-      #--disable-mencoder     disable mencoder (a/v encoder) compilation [enable]
-      #--enable-gui           enable gmplayer compilation (GTK+ GUI) [disable]
-      #--enable-gtk1          force using GTK 1.2 for GUI  [disable]
-      #--enable-largefiles    enable support for files > 2 GBytes [disable]
-      #--enable-linux-devfs   set default devices to devfs ones [disable]
-      #--enable-termcap       use termcap database for key codes [autodetect]
-      #--enable-termios       use termios database for key codes [autodetect]
-      #--disable-iconv        do not use iconv(3) function [autodetect]
-      #--disable-langinfo     do not use langinfo [autodetect]
-      #--enable-lirc          enable LIRC (remote control) support [autodetect]
-      #--enable-lircc         enable LIRCCD (LIRC client daemon) input [autodetect]
-      #--enable-joystick      enable joystick support [disable]
-      #--disable-vm           disable support X video mode extensions [autodetect]
-      #--disable-xf86keysym   disable support for 'multimedia' keys [autodetect]
-      #--enable-radio         enable Radio Interface [disable]
-      #--enable-radio-capture enable Capture for Radio Interface (through pci/line-in) [disable]
-      #--disable-radio-v4l2   disable Video4Linux2 Radio Interface support [autodetect]
-      #--disable-tv           disable TV Interface (tv/dvb grabbers) [enable]
-      #--disable-tv-v4l1      disable Video4Linux TV Interface support [autodetect]
-      #--disable-tv-v4l2      disable Video4Linux2 TV Interface support [autodetect]
-      #--disable-tv-bsdbt848  disable BSD BT848 Interface support [autodetect]
-      #--disable-pvr          disable Video4Linux2 MPEG PVR support [autodetect]
-      #--disable-rtc          disable RTC (/dev/rtc) on Linux [autodetect]
-      #--disable-network      disable network support (for: http/mms/rtp) [enable]
-      #--enable-winsock2      enable winsock2 usage [autodetect]
-      #--enable-smb           enable Samba (SMB) input support [autodetect]
-      #--enable-live          enable LIVE555 Streaming Media support [autodetect]
-      #--disable-dvdnav       disable libdvdnav support [autodetect]
-      #--disable-dvdread      Disable libdvdread support [autodetect]
-      #--disable-mpdvdkit     Disable mpdvdkit2 support [autodetect]
-      #--disable-cdparanoia   Disable cdparanoia support [autodetect]
-      #--disable-bitmap-font  Disable bitmap font support [enable]
-      #--disable-freetype     Disable freetype2 font rendering support [autodetect]
-      #--disable-fontconfig   Disable fontconfig font lookup support [autodetect]
-      #--disable-unrarlib     Disable Unique RAR File Library [enabled]
-      #--enable-menu          Enable OSD menu support (NOT DVD MENU) [disabled]
-      #--disable-sortsub      Disable subtitles sorting [enabled]
-      #--enable-fribidi       Enable using the FriBiDi libs [autodetect]
-      #--disable-enca         Disable using ENCA charset oracle library [autodetect]
-      #--disable-macosx       Disable Mac OS X specific features [autodetect]
-      #--disable-maemo        Disable maemo specific features [autodetect]
-      #--enable-macosx-finder-support  Enable Mac OS X Finder invocation parameter parsing [disabled]
-      #--enable-macosx-bundle Enable Mac OS X bundle file locations [autodetect]
-      #--disable-inet6        Disable IPv6 support [autodetect]
-      #--disable-gethostbyname2  gethostbyname() function is not provided by the C
-                                #library [autodetect]
-      #--disable-ftp          Disable ftp support [enabled]
-      #--disable-vstream      Disable tivo vstream client support [autodetect]
-      #--disable-pthreads     Disable Posix threads support [autodetect]
-      #--disable-ass          Disable internal SSA/ASS subtitles support [autodetect]
-      #--enable-rpath         Enable runtime linker path for extra libs [disabled]
-
-      # Codecs
-      #--enable-png           enable png input/output support [autodetect]
-      #--enable-jpeg          enable jpeg input/output support [autodetect]
-      #--enable-libcdio       enable external libcdio support [autodetect]
-      #--enable-liblzo        enable external liblzo support [autodetect]
-      #--disable-win32        disable Win32 DLL support [autodetect]
-      #--disable-qtx          disable Quicktime codecs [autodetect]
-      #--disable-xanim        disable XAnim DLL support [autodetect]
-      #--disable-real         disable RealPlayer DLL support [autodetect]
-      #--disable-xvid         disable XviD codec [autodetect]
-      #--disable-x264         disable H.264 encoder [autodetect]
-      #--disable-nut          disable libnut demuxer [autodetect]
-      #--disable-libavutil    disable libavutil [autodetect]
-      #--disable-libavcodec   disable libavcodec [autodetect]
-      #--disable-libavformat  disable libavformat [autodetect]
-      #--disable-libpostproc  disable libpostproc [autodetect]
-      #--disable-libavutil_so   disable shared libavutil [autodetect]
-      #--disable-libavcodec_so  disable shared libavcodec [autodetect]
-      #--disable-libavformat_so disable shared libavformat [autodetect]
-      #--disable-libpostproc_so disable shared libpostproc [autodetect]
-      #--disable-libavcodec_mpegaudio_hp disable high precision audio decoding
-      #                                  in libavcodec [enabled]
-      #--enable-libfame       enable libfame realtime encoder [autodetect]
-      #--disable-tremor-internal do not build internal Tremor support [enabled]
-      #--enable-tremor-low    build with lower accuracy internal Tremor [disabled]
-      #--enable-tremor-external build with external Tremor [autodetect]
-      #--disable-libvorbis    disable libvorbis support [autodetect]
-      #--disable-speex        disable Speex support [autodetect]
-      theora = { cfgOption = "--enable-theora"; buildInputs = "libtheora"; };
-      #--enable-theora        build with OggTheora support [autodetect]
-      #--enable-faad-external build with external FAAD2 (AAC) support [autodetect]
-      #--disable-faad-internal disable internal FAAD2 (AAC) support [autodetect]
-      #--enable-faad-fixed    enable fixed-point mode in internal FAAD2 [disabled]
-      #--disable-faac         disable support for FAAC (AAC encoder) [autodetect]
-      #--disable-ladspa       disable LADSPA plugin support [autodetect]
-      #--disable-libdv        disable libdv 0.9.5 en/decoding support [autodetect]
-      #--disable-mad          disable libmad (MPEG audio) support [autodetect]
-      #--disable-toolame      disable Toolame (MPEG layer 2 audio) support in mencoder [autodetect]
-      #--disable-twolame      disable Twolame (MPEG layer 2 audio) support in mencoder [autodetect]
-      #--enable-xmms          build with XMMS inputplugin support [disabled]
-      #--disable-mp3lib       disable builtin mp3lib [enabled]
-      #--disable-liba52       disable builtin liba52 [enabled]
-      #--enable-libdts        enable libdts support [autodetect]
-      #--disable-libmpeg2     disable builtin libmpeg2 [enabled]
-      #--disable-musepack     disable musepack support [autodetect]
-      #--disable-amr_nb       disable amr narrowband, floating point [autodetect]
-      #--disable-amr_nb-fixed disable amr narrowband, fixed point [autodetect]
-      #--disable-amr_wb       disable amr wideband, floating point [autodetect]
-      #--disable-decoder=DECODER disable specified FFmpeg decoder
-      #--enable-decoder=DECODER  enable specified FFmpeg decoder
-      #--disable-encoder=ENCODER disable specified FFmpeg encoder
-      #--enable-encoder=ENCODER  enable specified FFmpeg encoder
-      #--disable-parser=PARSER   disable specified FFmpeg parser
-      #--enable-parser=PARSER    enable specified FFmpeg parser
-      #--disable-demuxer=DEMUXER disable specified FFmpeg demuxer
-      #--enable-demuxer=DEMUXER  enable specified FFmpeg demuxer
-      #--disable-muxer=MUXER     disable specified FFmpeg muxer
-      #--enable-muxer=MUXER      enable specified FFmpeg muxer--enable-muxer=MUXER      enable specified FFmpeg muxer
-
-     # Video output
-      #--disable-vidix-internal disable internal VIDIX [for x86 *nix]
-      #--disable-vidix-external disable external VIDIX [for x86 *nix]
-      #--enable-gl            build with OpenGL render support [autodetect]
-      #--enable-dga[=n]       build with DGA [n in {1, 2} ] support [autodetect]
-      #--enable-vesa          build with VESA support [autodetect]
-      #--enable-svga          build with SVGAlib support [autodetect]
-      #--enable-sdl           build with SDL render support [autodetect]
-      #--enable-aa            build with AAlib render support [autodetect]
-      caca =              { cfgOption = "--enable-caca"; buildInputs = "libcaca"; };    # CACA render support
-      #--enable-ggi           build with GGI render support [autodetect]
-      #--enable-ggiwmh        build with GGI libggiwmh extension [autodetect]
-      #--enable-directx       build with DirectX support [autodetect]
-      #--enable-dxr2          build with DXR2 render support [autodetect]
-      #--enable-dxr3          build with DXR3/H+ render support [autodetect]
-      #--enable-ivtv          build with IVTV TV-Out render support [autodetect]
-      #--enable-dvb           build with support for output via DVB-Card [autodetect]
-      #--enable-dvbhead       build with DVB support (HEAD version) [autodetect]
-      #--enable-mga           build with mga_vid (for Matrox G200/G4x0/G550) support
-      #                       (check for /dev/mga_vid) [autodetect]
-      #--enable-xmga          build with mga_vid X Window support
-      #                       (check for X & /dev/mga_vid) [autodetect]
-      xv       = { cfgOption = "--enable-xv"; buildInputs = "libXv"; }; # Xv render support for X 4.x
-      #--enable-xvmc          build with XvMC acceleration for X 4.x [disable]
-      #--enable-vm            build with XF86VidMode support for X11 [autodetect]
-      xinerama = { cfgOption = "--enable-xinerama"; buildInputs = "libXinerama"; }; # Xinerama support for X11
-      #--enable-x11           build with X11 render support [autodetect]
-      #--enable-xshape        build with XShape support [autodetect]
-      #--enable-fbdev         build with FBDev render support [autodetect]
-      #--enable-mlib          build with mediaLib support (Solaris only) [disable]
-      #--enable-3dfx          build with obsolete /dev/3dfx support [disable]
-      #--enable-tdfxfb        build with tdfxfb (Voodoo 3/banshee) support [disable]
-      #--enable-s3fb          build with s3fb (S3 ViRGE) support [disable]
-      #--enable-directfb      build with DirectFB support [autodetect]
-      #--enable-zr            build with ZR360[56]7/ZR36060 support [autodetect]
-      #--enable-bl            build with Blinkenlights support [disable]
-      #--enable-tdfxvid       build with tdfx_vid support [disable]
-      #--disable-tga          disable targa output support [enable]
-      #--disable-pnm          disable pnm output support [enable]
-      #--disable-md5sum       disable md5sum output support [enable]
-
-
-      # Audio Output (they are all autodetect but adding the enable flag will show \
-      #               wrong cofigured libraries I hope)
-        # the ones beeing commented out I don't know exactly which libraries they need?
-        alsa = { cfgOption = "--enable-alsa";  buildInputs = "alsaLib"; };
-        #oss = { cfgOption = "--enable-oss"; buildInputs = "oss"; };
-        #arts = { cfgOption = "--enable-arts"; buildInputs = "arts"; };
-        esd = { cfgOption = "--enable-esd"; buildInputs = "esound"; };
-        #polyp = { cfgOption = "--enable-polyp"; buildInputs = "polyp"; };
-        #jack = { cfgOption = "--enable-jack"; buildInputs = "jack"; };
-        #openal = { cfgOption = "--enable-openal"; buildInputs = "openal"; };
-        #nas = { cfgOption = "--enable-nas"; buildInputs = "nas"; };
-        #sgiaudio = { cfgOption = "--enable-sgiaudio"; buildInputs = "sgiaudio"; };
-        #sunaudio = { cfgOption = "--enable-sunaudio"; buildInputs = "sunaudio"; };
-        #win32waveout = { cfgOption = "--enable-win32waveout"; buildInputs = "win32waveout"; };
-
-        disableSelect = { cfgOption = "--disable-select"; }; # disable using select() on audio device [enable]
-
-      #Miscellaneous options:
-        #--enable-runtime-cpudetection    Enable runtime CPU detection [disable]
-        #--enable-cross-compile Enable cross-compilation [autodetect]
-        #--cc=COMPILER          use this C compiler to build MPlayer [gcc]
-        #--host-cc=COMPILER     use this C compiler to build apps needed for the build process [gcc]
-        #--as=ASSEMBLER         use this assembler to build MPlayer [as]
-        #--target=PLATFORM      target platform (i386-linux, arm-linux, etc)
-        #--enable-static        build a statically linked binary. Set further linking
-                               #options with --enable-static="-lslang -lncurses"
-        #--charset              convert the help messages to this charset
-        #--language=list        a white space or comma separated list of languages
-                               #for translated man pages, the first language is the
-                               #primary and therefore used for translated messages
-                               #and GUI (also the environment variable $LINGUAS is
-                               #honored) [en]
-                               #(Available: bg cs de dk el en es fr hu it ja ko mk nb nl pl ro ru sk sv tr uk pt_BR zh
-      #_CN zh_TW all)
-
-    };
-    optionals = [ "esound" "alsa" "xv" "theora" "caca" "xinerama" "libXrandr" "esd" ];
-  };
-
-in args.stdenv.mkDerivation {
-
-  inherit (co) buildInputs;
-
-  name = "MPlayer-1.0rc1try2NewConfig";
-  #name = "MPlayer-snapshot";
-
-  #src = fetchurl {
-  #  url = http://www7.mplayerhq.hu/MPlayer/releases/mplayer-checkout-snapshot.tar.bz2;
-  #  sha1 = "529682cdea4f412d35f2c456897ab8808810975c";
-  #};
-
-  src = fetchurl {
-    url = http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2;
-    sha1 = "a450c0b0749c343a8496ba7810363c9d46dfa73c";
-  };
-
-  configurePhase = "./configure --prefix=\$out " + co.configureFlags
-    # FIXME to which options do these settings belong?
-    + " --with-win32libdir=${win32codecs}"
-    + " --with-reallibdir=${win32codecs}"
-    + " --enable-runtime-cpudetection"
-    + " --enable-x11"
-    + " --with-x11libdir=/no-such-dir"
-    + " --with-extraincdir=${libX11}/include"
-    + " --disable-xanim";
-
-  # Provide a reasonable standard font.  Maybe we should symlink here.
-  postInstall = "cp ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mplayer/subfont.ttf";
-
-  patches = [
-   # These fix MPlayer's aspect ratio when run in a screen rotated with
-   # Xrandr.
-   # See: http://itdp.de/~itdp/html/mplayer-dev-eng/2005-08/msg00427.html
-   ./mplayer-aspect.patch
-   ./mplayer-pivot.patch
-
-   # Security fix.
-   ./asmrules-fix.patch
-  ];
-
-  meta = {
-    homepage = http://www.mplayerhq.hu/;
-    description = "A movie player that supports many video formats";
-    license = "GPL-2";
-  };
-
-}
diff --git a/pkgs/development/compilers/bigloo/default.nix b/pkgs/development/compilers/bigloo/default.nix
index 53e1099a069e7..efb762b20185d 100644
--- a/pkgs/development/compilers/bigloo/default.nix
+++ b/pkgs/development/compilers/bigloo/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv }:
 
 stdenv.mkDerivation rec {
-  name = "bigloo3.1b";
+  name = "bigloo3.2a-alpha04Dec08";
 
   src = fetchurl {
     url = "ftp://ftp-sop.inria.fr/mimosa/fp/Bigloo/${name}.tar.gz";
-    sha256 = "1m7mrrrqm6668j6x834mclzc9am63wlf0knm4xiwrhv3zcky8vnv";
+    sha256 = "1sqzqlg6zrmh9980qk5w7rm9jnb85zsf3nqy0741ibx30wvbrki9";
   };
 
   patchPhase = ''
diff --git a/pkgs/development/compilers/hugs/default.nix b/pkgs/development/compilers/hugs/default.nix
index 1918f8f372b2f..c910d88ccb19f 100644
--- a/pkgs/development/compilers/hugs/default.nix
+++ b/pkgs/development/compilers/hugs/default.nix
@@ -1,57 +1,56 @@
-args: with args.lib; with args;
-let
-  co = chooseOptionsByFlags {
-    inherit args;
-    flagDescr = {
-      # does without X make sense? We can try
-      mandatory ={ cfgOption = [ "--prefix=\$out" ]; implies = "pthreads"; };
-      pathcanonicalization = { cfgOption = "--enable-path-canonicalization"; }; # enable canonicalization of filenames
-      timer = { cfgOption = "--enable-timer"; };#          enable evaluation timing (for benchmarking Hugs)
-      profiling = { cfgOption = "--enable-profiling"; };#      enable heap profiler
-      stack = { cfgOption = "--enable-stack-dumps"; };#-dumps    enable stack dump on stack overflow
-      large = { cfgOption = "--disable-large-banner"; };#-banner  disable multiline startup banner
-      internal = { cfgOption = "--enable-internal-prims"; };#-prims experimental primitives to access Hugs's innards
-      debug = { cfgOption = "--enable-debug"; };#          include C debugging information (for debugging Hugs)
-      tag = { cfgOption = "--enable-tag-checks"; };#-checks     runtime tag checking (for debugging Hugs)
-      lint = { cfgOption = "--enable-lint"; };#           enable "lint" flags (for debugging Hugs)
-      only98 = { cfgOption = "--enable-only98"; };#         build Hugs to understand Haskell 98 only
-      ffi = { cfgOption = "--enable-ffi"; };#            include modules that use the FFI [default=autodetect]
-      char = { cfgOption = "--enable-char-encoding"; blocks = "utf8"; };
-                                                        #-encoding  encode all character I/O using the byte encoding
-                                                        #determined by the locale in effect at that time. To
-                                                        #require that the UTF-8 encoding is always used, give
-                                                        #the --enable-char-encoding=utf8 option.
-                                                        #[default=autodetect]
-      utf8 = { cfgOption = "--enable-char-encoding=utf8"; blocks="char"; };
-
-
-      #--with-nmake            produce a Makefile compatible with nmake
-      #--with-gui              build Hugs for Windows GUI (Borland C++ only)
-      pthreads = { cfgOption = "--with-pthreads"; }; #   build Hugs using POSIX threads C library
-                                                   # I think we need this as long as not using nptl ?
+args: with args;
+let edf = composableDerivation.edf;
+    wwf = composableDerivation.wwf; in
+composableDerivation.composableDerivation {
+  initial = {
 
-    };
-    optionals = [];
-    defaultFlags = ["ffi"];
-  };
-
-in args.stdenv.mkDerivation {
-
-  # passing the flags in case a library using this want's to check them (*) .. 
-  inherit (co) /* flags */ buildInputs;
+    name="hugs98";
 
-  configurePhase="./configure --prefix=\$out";
-
-  src = fetchurl {
-      url = http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz;
-      sha256 = "3cf4d27673564cffe691bd14032369f646233f14daf2bc37c6c6df9f062b46b6";
+    src = fetchurl {
+        url = http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz;
+        sha256 = "3cf4d27673564cffe691bd14032369f646233f14daf2bc37c6c6df9f062b46b6";
     };
 
-  name="hugs98";
-
-  meta = {
-    license = "as-is"; # gentoo is calling it this way..
-    description = "The HUGS98 Haskell <interpreter";
-    homepage = http://www.haskell.org/hugs;
+        #encode all character I/O using the byte encoding
+        #determined by the locale in effect at that time. To
+        #require that the UTF-8 encoding is always used, give
+        #the --enable-char-encoding=utf8 option.
+        #[default=autodetect]
+    postUnpack = ''
+      find -type f | xargs sed -i 's@/bin/cp@cp@';
+    '';
+    configurePhase="./configure --prefix=\$out --enable-char-encoding=utf8 $configureFlags";
+
+    flags =
+         edf { name = "pathCanonicalization"; feat="path-canonicalization"; }
+      // edf { name="timer"; }   # enable evaluation timing (for benchmarking Hugs)
+      // edf { name="profiling"; }# enable heap profiler
+      // edf { name="stackDumps"; feat="stack-dummps"; } # enable stack dump on stack overflow
+      // edf { name="largeBanner"; feat="large-banner"; } # disable multiline startup banner
+      // edf { name="internal-prims"; } # experimental primitives to access Hugs's innards
+      // edf { name="debug"; } # include C debugging information (for debugging Hugs)
+      // edf { name="tag"; } # runtime tag checking (for debugging Hugs)
+      // edf { name="lint"; } # enable "lint" flags (for debugging Hugs)
+      // edf { name="only98"; } # build Hugs to understand Haskell 98 only
+      // edf { name="ffi"; }
+        #--with-nmake            produce a Makefile compatible with nmake
+        #--with-gui              build Hugs for Windows GUI (Borland C++ only)
+      // wwf { name="pthreads"; } #   build Hugs using POSIX threads C library
+      ;
+
+    cfg = {
+      largeBannerSupport = true; # seems to be default
+
+
+        char = { cfgOption = "--enable-char-encoding"; blocks = "utf8"; };
+        utf8 = { cfgOption = "--enable-char-encoding=utf8"; blocks="char"; };
+
+      };
+
+    meta = {
+      license = "as-is"; # gentoo is calling it this way..
+      description = "The HUGS98 Haskell <interpreter";
+      homepage = http://www.haskell.org/hugs;
+    };
   };
 }
diff --git a/pkgs/development/compilers/roadsend/default.nix b/pkgs/development/compilers/roadsend/default.nix
index c7b04f8710908..c6d2249c8947d 100644
--- a/pkgs/development/compilers/roadsend/default.nix
+++ b/pkgs/development/compilers/roadsend/default.nix
@@ -1,31 +1,33 @@
-args:
-let edf = args.lib.enableDisableFeature; in
-( args.mkDerivationByConfiguration {
-    flagConfig = {
-      mandatory = { buildInputs = ["bigloo" "curl"]; };
-    } // edf "pcre" "pcre" { } #support pcre extension [default=check]
-      // edf "fcgi" "fcgi" { pass = "fcgi"; } #support FastCGI web backend [default=check]
-      // edf "xml" "xml" { pass ="libxml2"; } #support xml extension [default=check]
-      // edf "mysql" "mysql" { pass = "mysql"; } #support mysql extension [default=check]
-      #// edf "sqlite3=[ARG]" "sqlite3=[ARG]" { } [>use SQLite 3 library [default=yes], optionally
-                                #specify the prefix for sqlite3 library
-      // edf "odbc" "odbc" { } #support ODBC extension [default=check]
-      // edf "gtk" "gtk" { } #support PHP-GTK extension [default=no]
-      // edf "gtk2" "gtk2" { }; #support PHP-GTK 2 extension [default=no]
-
-    optionals = [ "libxml2" "gettext" "fcgi" ];
-    extraAttrs = co : {
-      name = "roadsend-2.9.3";
+args: with args;
+let edf = composableDerivation.edf; in
+composableDerivation.composableDerivation {
+  initial = {
+    name = "roadsend-2.9.3";
+    buildInputs = [bigloo curl];
+    flags = edf { name = "pcre"; }
+         // edf { name = "fcgi"; enable = { inherit fcgi; }; }
+         // edf { name = "xml"; enable = { buildInputs = [ libxml2 ]; }; }
+         // edf { name = "mysql"; enable = { buildInputs = [ mysql ]; }; }
+         // edf { name = "odbc"; };
+         # // edf { name = "gtk"} }
+         # // edf { name = "gtk2", enable = { buildInputs = [ mysql ]; } }
+    cfg = {
+      pcreSupport = true;
+      fcgiSupport = true;
+      xmlSupport = true;
+      mysqlSupport = true;
+    };
+    src = args.fetchurl {
+      url = "http://code.roadsend.com/snaps/roadsend-php-20081210.tar.bz2";
+      sha256 = "0yhpiik0dyayd964wvn2k0cq7b1gihx1k3qx343r2l7lla4mapsx";
+    };
 
-      src = args.fetchurl {
-        url = "http://code.roadsend.com/snaps/roadsend-php-2.9.4.tar.bz2";
-        sha256 = "0nw7rvrrwkss5cp6ws0m3q63q1mcyy27s8yjhy7kn508db1rgl9x";
-      };
+#    http://code.roadsend.com/snaps/roadsend-php-testsuite-2.9.7.tar.bz2";
+#   sha256 = "0rf0g9r0prla7daq3aif24d7dx0j01i35hcm8h5bbg3gvpfim463";
 
     # tell pcc where to find the fastcgi library 
-      postInstall = " sed -e \"s=(ldflags fastcgi.*=(ldflags -l fastcgi -L \$fcgi)=\" -i \$out/etc/pcc.conf ";
-
-    meta = { 
+    postInstall = " sed -e \"s=(ldflags fastcgi.*=(ldflags -l fastcgi -L \$fcgi)=\" -i \$out/etc/pcc.conf ";
+    meta = {
       description = "roadsend PHP -> C compiler";
       homepage = http://www.roadsend.com;
       # you can choose one of the following licenses: 
@@ -33,4 +35,4 @@ let edf = args.lib.enableDisableFeature; in
       license = ["GPL2"];
     };
   };
-} ) args
+}
diff --git a/pkgs/development/interpreters/php_configurable/default.nix b/pkgs/development/interpreters/php_configurable/default.nix
index d10efcec80211..d079c83f364b6 100644
--- a/pkgs/development/interpreters/php_configurable/default.nix
+++ b/pkgs/development/interpreters/php_configurable/default.nix
@@ -1,122 +1,126 @@
 let version = "5.2.6"; in
 
-args:
+args: with args;
 
-(args.mkDerivationByConfiguration {
+let inherit (args.composableDerivation) composableDerivation edf wwf; in
 
-  flagConfig = {
+composableDerivation {
+  initial = fixed : {
 
-# much left to do here... 
+    name = "php_configurable-${version}";
 
-    mandatory = { buildInputs = ["flex" "bison" "pkgconfig"]; };
+    buildInputs = ["flex" "bison" "pkgconfig"];
 
-    # SAPI modules:
-    
-    apxs2 = {
-      cfgOption = "--with-apxs2=\$apacheHttpd/bin/apxs";
-      pass = "apacheHttpd";
-    };
+    flags = {
 
-    # Extensions 
+# much left to do here...
 
-    curl = {
-      cfgOption = "--with-curl=${args.curl} --with-curlwrappers";
-      pass = "curl";
-    };
+      # SAPI modules:
       
-    zlib = {
-      cfgOption = "--with-zlib=${args.zlib}";
-      pass = "zlib";
-    };
+        apxs2 = {
+          configureFlags = ["--with-apxs2=${apacheHttpd}/bin/apxs"];
+          buildInputs = [apacheHttpd];
+        };
 
-    libxml2 = {
-      cfgOption = "--with-libxml-dir=\$libxml2";
-      pass = { inherit (args) libxml2; }; 
-    };
-    
-    no_libxml2 = {
-      cfgOption = "--disable-libxml";
-    };
+        # Extensions
 
-    postgresql = {
-      cfgOption = "--with-pgsql=\$postgresql";
-      pass = { inherit (args) postgresql; };
-    };
-    
-    mysql = {
-      cfgOption = "--with-mysql=\$mysql";
-      pass = { inherit (args) mysql; };
-    };
+        curl = {
+          configureFlags = ["--with-curl=${args.curl}" "--with-curlwrappers"];
+          buildInputs = [curl];
+        };
+        
+        zlib = {
+          configureFlags = ["--with-zlib=${args.zlib}"];
+          buildInputs = [zlib];
+        };
 
-    mysqli = {
-      cfgOption = "--with-mysqli=\$mysql/bin/mysql_config";
-      pass = { inherit (args) mysql; }; 
-    };
+        libxml2 = {
+          configureFlags = ["--with-libxml-dir=${libxml2}"];
+          buildInputs = [ libxml2 ];
+        };
+      
+        postgresql = {
+          configureFlags = ["--with-pgsql=${postgresql}"];
+          buildInputs = [ postgresql ];
+        };
+      
+        mysql = {
+          configureFlags = ["--with-mysql=${mysql}"];
+          buildInputs = [ mysql ];
+        };
 
-    mysqli_embedded = {
-      cfgOption = "--enable-embedded-mysqli";
-      depends = "mysqli";
-    };
+        mysqli = {
+          configureFlags = ["--with-mysqli=${mysql}/bin/mysql_config"];
+          buildInputs = [ mysql];
+        };
 
-    pdo_mysql = {
-      cfgOption = "--with-pdo-mysql=\$mysql";
-      pass = { inherit (args) mysql; }; 
-    };
-    
-    no_pdo_mysql = { };
+        mysqli_embedded = {
+          configureFlags = ["--enable-embedded-mysqli"];
+          depends = "mysqli";
+          assertion = fixed.mysqliSupport;
+        };
 
-    bcmath = {
-      cfgOption = "--enable-bcmath";
-    };
+        pdo_mysql = {
+          configureFlags = ["--with-pdo-mysql=${mysql}"];
+          buildInputs = [ mysql ];
+        };
+      
+        bcmath = {
+          configureFlags = ["--enable-bcmath"];
+        };
 
-    gd = {
-      cfgOption = "--with-gd=${args.gd}";
-      buildInputs = ["gd"]; # <-- urgh, these strings are ugly
-    };
+        gd = {
+          configureFlags = ["--with-gd=${args.gd}"];
+          buildInputs = [gd];
+        };
 
-    sockets = {
-      cfgOption = "--enable-sockets";
-    };
+        sockets = {
+          configureFlags = ["--enable-sockets"];
+        };
 
-    openssl = {
-      cfgOption = "--with-openssl=${args.openssl}";
-      buildInputs = ["openssl"];
-    };
+        openssl = {
+          configureFlags = ["--with-openssl=${args.openssl}"];
+          buildInputs = ["openssl"];
+        };
 
-    /*
-       Building xdebug withing php to be able to add the parameters to the ini file.. Ther should be a better way
-      meta = { 
-              description = "debugging support for PHP";
-              homepage = http://xdebug.org;
-              license = "based on the PHP license - as is";
-              };
-    */
-    xdebug = {
-      buildInputs = [ "automake" "autoconf" ];
-      pass = {
-        xdebug_src = args.fetchurl {
-          name = "xdebug-2.0.2.tar.gz";
-          url = "http://xdebug.org/link.php?url=xdebug202";
-          sha256 = "1h0bxvf8krr203fmk1k7izrrr81gz537xmd3pqh4vslwdlbhrvic";
+        /*
+           Building xdebug withing php to be able to add the parameters to the ini file.. Ther should be a better way
+          meta = {
+                  description = "debugging support for PHP";
+                  homepage = http://xdebug.org;
+                  license = "based on the PHP license - as is";
+                  };
+        */
+        xdebug = {
+          buildInputs = [ automake autoconf ];
+          xdebug_src = args.fetchurl {
+            name = "xdebug-2.0.2.tar.gz";
+            url = "http://xdebug.org/link.php?url=xdebug202";
+            sha256 = "1h0bxvf8krr203fmk1k7izrrr81gz537xmd3pqh4vslwdlbhrvic";
+          };
         };
       };
-    };
-
-  };
-
-  defaults = [ "mysql" "mysqli" "pdo_mysql" "libxml2" "apxs2" "bcmath" ];
-  
-  optionals = [ "libxml2" "gettext" "postgresql" "zlib" "openssl" ];
 
-  extraAttrs = co: {
-    name = "php_configurable-${version}";
-
-    buildInputs = args.lib.getAttr ["phpIncludes"] [] args ++ co.buildInputs;
+    cfg = {
+      mysqlSupport = true;
+      mysqliSupport = true;
+      pdo_mysqlSupport = true;
+      libxml2Support = true;
+      apxs2Support = true;
+      bcmathSupport = true;
+      socketsSupport = true;
+      curlSupport = true;
+      gettextSupport = true;
+      postgresqlSupport = true;
+      zlibSupport = true;
+      opnesslSupport = true;
+      xdebugSupport = true;
+    };
 
     configurePhase = ''
       iniFile=$out/etc/$name.ini
       [[ -z "$libxml2" ]] || export PATH=$PATH:$libxml2/bin
-      ./configure --with-config-file-scan-dir=/etc --with-config-file-path=$out/etc --prefix=$out ${co.configureFlags}
+      ./configure --with-config-file-scan-dir=/etc --with-config-file-path=$out/etc --prefix=$out  $configureFlags
       echo configurePhase end
     '';
 
@@ -124,11 +128,11 @@ args:
       unset installPhase; installPhase;
       cp php.ini-recommended $iniFile
 
-      # Now Let's build xdebug if flag has been given 
+      # Now Let's build xdebug if flag has been given
       # TODO I think there are better paths than the given below
       if [ -n $flag_set_xdebug ]; then
         PATH=$PATH:$out/bin
-        tar xfz $xdebug_src; 
+        tar xfz $xdebug_src;
         cd xdebug*
         phpize
         ./configure --prefix=$out
@@ -157,13 +161,14 @@ args:
       name = "php-${version}.tar.bz2";
     };
 
-    meta = { 
+    meta = {
       description = "The PHP language runtime engine";
       homepage = http://www.php.net/;
       license = "PHP-3";
     };
 
     patches = [./fix.patch];
+
   };
-  
-}) args
+
+}
diff --git a/pkgs/development/libraries/fltk/default.nix b/pkgs/development/libraries/fltk/default.nix
index 10034035ef1c6..6632088ade7a6 100644
--- a/pkgs/development/libraries/fltk/default.nix
+++ b/pkgs/development/libraries/fltk/default.nix
@@ -1,35 +1,47 @@
-args:
-( args.mkDerivationByConfiguration {
-    flagConfig = {
-      mandatory = { propagatedBuildInputs=["x11" "inputproto" "libXi"]; 
-                    blocks = ["cygwin" "quartz"]; }; # cgywin quartz and much more not yet tested
-      cygwin = { cfgOption = "--enable-cygwin"; }; #         use the CygWin libraries default=no
-      debug = { cfgOption = "--enable-debug"; }; #          turn on debugging default=no
-      gl = { cfgOption = "--enable-gl"; buildInputs = [ "mesa" ]; }; #             turn on OpenGL support default=yes
-      shared = { cfgOption = "--enable-shared"; }; #         turn on shared libraries default=no
-      threads = { cfgOption = "--enable-threads"; }; #        enable multi-threading support
-      quartz = { cfgOption = "--enable-quartz"; buildInputs = "quartz"; }; # don't konw yet what quartz is #         use Quartz instead of Quickdraw (default=no)
-      largefile = { cfgOption = "--disable-largefile"; }; #     omit support for large files
-      useNixLibs = { implies = [ "nixjpeg" "nixpng" "nixzlib" ]; }; # use nix libraries only
-      nixjpeg = { cfgOption = "--disable-localjpeg"; buildInputs = "libjpeg"; }; #      use local JPEG library, default=auto
-      nixzlib = { cfgOption = "--disable-localzlib"; buildInputs = "zlib"; }; #      use local ZLIB library, default=auto
-      nixpng = { cfgOption = "--disable-localpng"; buildInputs = "libpng"; }; #       use local PNG library, default=auto
-      xinerama = { cfgOption = "--enable-xinerama"; buildInputs = "xinerama"; }; #       turn on Xinerama support default=no
-      xft = { cfgOption = "--enable-xft"; buildInputs="xft"; }; #            turn on Xft support default=no
-      xdbe = { cfgOption = "--enable-xdbe"; }; #           turn on Xdbe support default=no
-    }; 
+args: with args;
+let inherit (args.composableDerivation) composableDerivation edf; in
+composableDerivation {
+  initial = {
 
-    extraAttrs = co : {
-      name = "fltk-2.0.x-r6483";
+    name = "fltk-2.0.x-r6483";
 
     src = args.fetchurl {
       url = ftp://ftp.easysw.com/pub/fltk/snapshots/fltk-2.0.x-r6483.tar.bz2;
       sha256 = "1n8b53r5p0zb4sbvr6pj8aasls4zjwksv1sdc3r3pzb20fikp5jb";
     };
 
-    meta = { 
+    propagatedBuildInputs=[x11 inputproto libXi freeglut];
+
+    buildInputs = [ args.pkgconfig ];
+
+    flags =
+      # this could be tidied up (?).. eg why does it require freeglut without glSupport?
+      edf { name = "cygwin"; }  #         use the CygWin libraries default=no
+      // edf { name = "debug"; }  #          turn on debugging default=no
+      // edf { name = "gl"; enable = { buildInputs = [ mesa ]; }; }  #             turn on OpenGL support default=yes
+      // edf { name = "shared"; }  #         turn on shared libraries default=no
+      // edf { name = "threads"; }  #        enable multi-threading support
+      // edf { name = "quartz"; enable = { buildInputs = "quartz"; }; }  # don't konw yet what quartz is #         use Quartz instead of Quickdraw (default=no)
+      // edf { name = "largefile"; } #     omit support for large files
+      // edf { name = "localjpeg"; disable = { buildInputs = [libjpeg]; }; } #       use local JPEG library, default=auto
+      // edf { name = "localzlib"; disable = { buildInputs = [zlib]; }; } #       use local ZLIB library, default=auto
+      // edf { name = "localpng"; disable = { buildInputs = [libpng]; }; } #       use local PNG library, default=auto
+      // edf { name = "xinerama"; enable = { buildInputs = [libXinerama]; }; } #       turn on Xinerama support default=no
+      // edf { name = "xft"; enable = { buildInputs=[libXft]; }; } #            turn on Xft support default=no
+      // edf { name = "xdbe"; };  #           turn on Xdbe support default=no
+    cfg = {
+        largefileSupport = true; # is default
+        glSupport = true; # doesn't build without it. Why?
+        localjpegSupport = false;
+        localzlibSupport = false;
+        localpngSupport = false;
+        sharedSupport = true;
+        threadsSupport = true;
+    };
+
+    meta = {
         description = "a C++ cross platform lightweight gui library binding";
         homepage = http://www.fltk.org;
     };
   };
-} ) args
+}
diff --git a/pkgs/development/libraries/geos/default.nix b/pkgs/development/libraries/geos/default.nix
index bcfe8f757a24b..10cc4d94d4042 100644
--- a/pkgs/development/libraries/geos/default.nix
+++ b/pkgs/development/libraries/geos/default.nix
@@ -1,42 +1,38 @@
-args:
-( args.mkDerivationByConfiguration {
+args: with args;
+let inherit (args.composableDerivation) composableDerivation edf; in
+composableDerivation {
 
-    flagConfig = {
-      mandatory = { implies = "python"; 
-                    buildInputs = [ "which" ]; # which is needed for the autogen.sh
-                  };
+  initial = {
+
+    buildInputs = [ "which" ]; # which is needed for the autogen.sh
+
+    flags =
     # python and ruby untested 
-      python =            { cfgOption = "--enable-python"; #Enable build of python module
-                            buildInputs=["python"] ++ (if args.use_svn then ["libtool" "autoconf" "automake" "swig"] else []); 
-                          };
-      ruby =              { cfgOption = "--enable-ruby"; };  #Enable build of ruby module
-    }; 
+      edf { name = "python"; enable = { buildInputs = [ python ]; }; };
+      # (if args.use_svn then ["libtool" "autoconf" "automake" "swig"] else [])
+      # // edf { name = "ruby"; enable = { buildInputs = [ ruby ]; };}
 
-    extraAttrs = co : {
-      name = "geos-3.0.0rc4";
+    name = "geos-3.0.3";
 
-      src = if (args.use_svn) then
-        args.fetchsvn { 
-            url = http://svn.osgeo.org/geos/trunk; 
-            md5 = "b46f5ea517a337064006bab92f3090d4";
-        } else args.fetchurl {
-          url = http://geos.refractions.net/geos-3.0.0rc4.tar.bz2;
-          sha256 = "0pgwwv8q4p234r2jwdkaxcf68z2fwgmkc74c6dnmms2sdwkb5lbw";
-        };
+    src = fetchurl {
+        url = http://download.osgeo.org/geos/geos-3.0.3.tar.bz2;
+        sha256 = "1pxk20jcbyidp3bvip1vdf8wfw2wvh8pcn810qkf1y3zfnki0c7k";
+    };
 
-      configurePhase = "
-        [ -f configure ] || \\
-        LIBTOOLIZE=libtoolize ./autogen.sh
-        #{ automake --add-missing; autoconf; }
-        unset configurePhase; configurePhase
-        ";
+    # for development version. can be removed ?
+    #configurePhase = "
+    #  [ -f configure ] || \\
+    #  LIBTOOLIZE=libtoolize ./autogen.sh
+    #  [>{ automake --add-missing; autoconf; }
+    #  unset configurePhase; configurePhase
+    #";
 
-      meta = {
-          description = "C++ port of the Java Topology Suite (JTS)"
-            + "- all the OpenGIS \"Simple Features for SQL\" spatial predicate functions and spatial operators,"
-            + " as well as specific JTS topology functions such as IsValid";
-          homepage = http://geos.refractions.net/;
-          license = "GPL";
-      };
+    meta = {
+        description = "C++ port of the Java Topology Suite (JTS)"
+          + "- all the OpenGIS \"Simple Features for SQL\" spatial predicate functions and spatial operators,"
+          + " as well as specific JTS topology functions such as IsValid";
+        homepage = http://geos.refractions.net/;
+        license = "GPL";
+    };
   };
-} ) args
+}
diff --git a/pkgs/development/libraries/libdv/default.nix b/pkgs/development/libraries/libdv/default.nix
index 4b0e05acf98d1..70211e928ee8a 100644
--- a/pkgs/development/libraries/libdv/default.nix
+++ b/pkgs/development/libraries/libdv/default.nix
@@ -1,30 +1,29 @@
-args:
-let edf = args.lib.enableDisableFeature; in
-( args.mkDerivationByConfiguration {
-    flagConfig = { }
+args: with args;
+let inherit (args.composableDerivation) composableDerivation edf; in
+composableDerivation {
+  initial = {
+    flags = { }
       # TODO! implement flags
       # I want to get kino and cinelerra working. That's why I don't spend more time on this now
-      // edf "libtool_lock" "libtool_lock" { } #avoid locking (might break parallel builds)
-      // edf "asm" "asm" { } #disable use of architecture specific assembly code
-      // edf "sdl" "sdl" { } #enable use of SDL for display
-      // edf "gtk" "gtk" { } #disable use of gtk for display
-      // edf "xv" "xv" { } #disable use of XVideo extension for display
-      // edf "gprof" "gprof" { } #enable compiler options for gprof profiling
-    ;
+      // edf { name = "libtool_lock"; } #avoid locking (might break parallel builds)
+      // edf { name ="asm"; } #disable use of architecture specific assembly code
+      // edf { name ="sdl"; } #enable use of SDL for display
+      // edf { name ="gtk"; } #disable use of gtk for display
+      // edf { name ="xv"; } #disable use of XVideo extension for display
+      // edf { name ="gprof"; }; #enable compiler options for gprof profiling
 
-    extraAttrs = co : {
-      name = "libdv-1.0.0";
+    name = "libdv-1.0.0";
 
-      src = args.fetchurl {
-        url = mirror://sourceforge/libdv/libdv-1.0.0.tar.gz;
-        sha256 = "1fl96f2xh2slkv1i1ix7kqk576a0ak1d33cylm0mbhm96d0761d3";
-      };
+    src = args.fetchurl {
+      url = mirror://sourceforge/libdv/libdv-1.0.0.tar.gz;
+      sha256 = "1fl96f2xh2slkv1i1ix7kqk576a0ak1d33cylm0mbhm96d0761d3";
+    };
 
-    meta = { 
+    meta = {
       description = "software decoder for DV format video, as defined by the IEC 61834 and SMPTE 314M standards";
       homepage = http://sourceforge.net/projects/libdv/;
       # you can choose one of the following licenses: 
       license = [];
     };
   };
-} ) args
+}
diff --git a/pkgs/development/libraries/libsamplerate/default.nix b/pkgs/development/libraries/libsamplerate/default.nix
index 2ea959528a873..aa218f102cdc7 100644
--- a/pkgs/development/libraries/libsamplerate/default.nix
+++ b/pkgs/development/libraries/libsamplerate/default.nix
@@ -1,35 +1,31 @@
-args:
-( args.mkDerivationByConfiguration {
-    flagConfig = {
-      mandatory = { buildInputs = ["pkgconfig"];};
-    # are these options of interest? We'll see
-    #--disable-fftw          disable usage of FFTW
-    #--enable-debug          enable debugging
-    #--disable-cpu-clip      disable tricky cpu specific clipper
+args: with args;
+stdenv.mkDerivation {
 
-    }; 
+  name = "libsamplerate-0.1.2";
+
+  src = args.fetchurl {
+    url = http://www.mega-nerd.com/SRC/libsamplerate-0.1.2.tar.gz;
+    sha256 = "1m1iwzpcny42kcqv5as2nyb0ggrb56wzckpximqpp2y74dipdf4q";
+  };
 
-    extraAttrs = co : {
-      name = "libsamplerate-0.1.2";
 
-      src = args.fetchurl {
-        url = http://www.mega-nerd.com/SRC/libsamplerate-0.1.2.tar.gz;
-        sha256 = "1m1iwzpcny42kcqv5as2nyb0ggrb56wzckpximqpp2y74dipdf4q";
-      };
+  buildInputs = ["pkgconfig"];
+  # maybe interesting configure flags:
+  #--disable-fftw          disable usage of FFTW
+  #--disable-cpu-clip      disable tricky cpu specific clipper
 
-    configurePhase = "
-     export LIBSAMPLERATE_CFLAGS=\"-I \$libsamplerate/include\"
-     export LIBSAMPLERATE_LIBS=\"-L \$libsamplerate/libs\"
-     ./configure --prefix=\$out"+co.configureFlags;
+  configurePhase = "
+   export LIBSAMPLERATE_CFLAGS=\"-I \$libsamplerate/include\"
+   export LIBSAMPLERATE_LIBS=\"-L \$libsamplerate/libs\"
+   ./configure --prefix=\$out";
 
-    meta = { 
-      description = "Sample Rate Converter for audio";
-      homepage = http://www.mega-nerd.com/SRC/index.html;
-      # you can choose one of the following licenses: 
-      license = [ "GPL" 
-                  { url=http://www.mega-nerd.com/SRC/libsamplerate-cul.pdf; 
-                    name="libsamplerate Commercial Use License";
-                  } ];
-    };
+  meta = {
+    description = "Sample Rate Converter for audio";
+    homepage = http://www.mega-nerd.com/SRC/index.html;
+    # you can choose one of the following licenses:
+    license = [ "GPL"
+                { url=http://www.mega-nerd.com/SRC/libsamplerate-cul.pdf;
+                  name="libsamplerate Commercial Use License";
+                } ];
   };
-} ) args
+}
diff --git a/pkgs/development/tools/misc/avrdude/default.nix b/pkgs/development/tools/misc/avrdude/default.nix
index f87d305dfb2cf..38871c8fd4c56 100644
--- a/pkgs/development/tools/misc/avrdude/default.nix
+++ b/pkgs/development/tools/misc/avrdude/default.nix
@@ -1,32 +1,32 @@
-args:
-with args.lib; with args;
-let
-  co = chooseOptionsByFlags {
-    inherit args;
-    flagDescr = {
-      mandatory ={ cfgOption = [ "--disable-dependency-tracking" ]; 
-                   buildInputs=["yacc" "flex"]; };
-      doc = { cfgOption = "--enable-doc"; buildInputs=["tetex"]; blocks=["doc" "because untested"]; }; #Enable building documents
-      no_parport = { cfgOption = "--disable-parport"; }; #Enable accessing parallel ports(default)
+args: with args;
+let edf = composableDerivation.edf; in
+composableDerivation.composableDerivation {
+  initial = {
+    name="avrdude-5.4";
+
+    src = fetchurl {
+        url = http://mirror.switch.ch/mirror/gentoo/distfiles/avrdude-5.4.tar.gz;
+        sha256 = "bee4148c51ec95999d803cb9f68f12ac2e9128b06f07afe307d38966c0833b30";
     };
-    #defaultFlags = ["doc"];
-  };
 
-in stdenv.mkDerivation {
+    configureFlags = [ "--disable-dependency-tracking" ];
 
-  # passing the flags in case a library using this want's to check them (*) .. 
-  inherit (co) /* flags */ buildInputs configureFlags;
+    buildInputs = [yacc flex];
 
-  src = fetchurl {
-      url = http://mirror.switch.ch/mirror/gentoo/distfiles/avrdude-5.4.tar.gz;
-      sha256 = "bee4148c51ec95999d803cb9f68f12ac2e9128b06f07afe307d38966c0833b30";
-    };
+    flags =
+           edf { name = "doc"; enable = { buildInputs = texLive;  configureFlags = ["--enable-doc"]; }; }
+        // edf { name = "parport"; }
+        ;
 
-  name="avrdude-5.4";
+    cfg = {
+      docSupport = false; # untested
+      parportSupport = true;
+    };
 
-  meta = {
-    license = "GPL-2";
-    description = "AVR Downloader/UploaDEr";
-    homepage = http://savannah.nongnu.org/projects/avrdude;
+    meta = {
+      license = "GPL-2";
+      description = "AVR Downloader/UploaDEr";
+      homepage = http://savannah.nongnu.org/projects/avrdude;
+    };
   };
 }
diff --git a/pkgs/lib/composable-derivation.nix b/pkgs/lib/composable-derivation.nix
new file mode 100644
index 0000000000000..790a0bcc9dbcb
--- /dev/null
+++ b/pkgs/lib/composable-derivation.nix
@@ -0,0 +1,46 @@
+{lib, pkgs} :
+let inherit (lib) nv nvs; in
+{
+  # see new python derivations for example..
+  # You should be able to override anything you like easily
+  # grep the mailinglist by title "python proposal" (dec 08)
+  # -> http://mail.cs.uu.nl/pipermail/nix-dev/2008-December/001571.html
+  # to see why this got complicated when using all its features
+  composableDerivation = {
+          # modify args before applying stdenv.mkDerivation, this should remove at least attrs removeAttrsBy
+        f ? lib.prepareDerivationArgs,
+        stdenv ? pkgs.stdenv,
+          # initial set of arguments to be passed to stdenv.mkDerivation passing prepareDerivationArgs by default
+        initial ? {},
+          # example func :  (x: x // { x.buildInputs ++ ["foo"] }), but see mergeAttrByFunc which does this for you
+        merge ? (lib.mergeOrApply lib.mergeAttrByFunc)
+      }: lib.applyAndFun
+            (args: stdenv.mkDerivation (f args))
+            merge
+            (merge { inherit (lib) mergeAttrBy; } initial);
+
+  # some utility functions
+  # use this function to generate flag attrs for prepareDerivationArgs
+  # E nable  D isable F eature
+  edf = {name, feat ? name, enable ? {}, disable ? {} , value ? ""}:
+    nvs name {
+    set = {
+      configureFlags = ["--enable-${feat}${if value == "" then "" else "="}${value}"];
+    } // enable;
+    unset = {
+      configureFlags = ["--disable-${feat}"];
+    } // disable;
+  };
+
+  # same for --with and --without-
+  # W ith or W ithout F eature
+  wwf = {name, feat ? name, enable ? {}, disable ? {}, value ? ""}:
+    nvs name {
+    set = {
+      configureFlags = ["--with-${feat}${if value == "" then "" else "="}${value}"];
+    } // enable;
+    unset = {
+      configureFlags = ["--without-${feat}"];
+    } // disable;
+  };
+}
diff --git a/pkgs/lib/default.nix b/pkgs/lib/default.nix
index 66b67baafef76..6af24f6a6b004 100644
--- a/pkgs/lib/default.nix
+++ b/pkgs/lib/default.nix
@@ -805,251 +805,5 @@ rec {
     in removeAttrs
       (mergeAttrsByFuncDefaults ([args] ++ opts))
       ["flags" "cfg" "mergeAttrBy" "fixed" ]; # fixed may be passed as fix argument or such
-  # supportFlag functions for convinience
-  sFlagEnable = { name, buildInputs ? [], propagatedBuildInputs ? [] } : {
-      set = { configureFlags = "--enable-${name}"; inherit buildInputs; inherit propagatedBuildInputs; };
-      unset = { configureFlags = "--disable-${name}"; };
-    };
-
-
-
-# Marc 2nd proposal: (not everything has been tested in detail yet..)
-# depreceated because it's too complicated. use prepareDerivationArgs instead
-
-  # usage / example
-  # flagConfig = {
-  # } // (enableDisableFeature "flagName" "configure_feature" extraAttrs;)
-  #
-  # is equal to
-  # flagConfig = {
-  #   flagName = { cfgOption = "--enable-configure_feature"; } // extraAttrs;
-  #   no_flagName = { cfgOption = "--disable-configure_feature"; };
-  enableDisableFeature = flagName : configure_feature : extraAttrs :
-    listToAttrs [ ( nv flagName ({ cfgOption = "--enable-${configure_feature}"; } // extraAttrs ) )
-                  ( nv "no_${flagName}" ({ cfgOption = "--disable-${configure_feature}"; } ) )];
-
-  # calls chooseOptionsByFlags2 with some preprocessing
-  # chooseOptionsByFlags2 returns an attribute set meant to be used to create new derivaitons.
-  # see mkDerivationByConfiguration in all-packages.nix and the examples given below.
-  # You can just copy paste them into all-packages.nix to test them..
-
-  chooseOptionsByFlags = { flagConfig, args, optionals ? [], defaults ? [],
-                           collectExtraPhaseActions ? [] } :
-    let passedOptionals = filter ( x : hasAttr x args ) optionals; # these are in optionals and in args
-        # we simply merge in <optional_name> = { buildInputs = <arg.<optional_name>; pass = <arg.optional_name>; }
-        flagConfigWithOptionals = flagConfig // ( listToAttrs
-          (map ( o : nv o ( { buildInputs = o; pass = nvs o (builtins.getAttr o args); }
-                            // getAttr [o] {} flagConfig )
-               )
-               passedOptionals ) );
-
-    in chooseOptionsByFlags2 flagConfigWithOptionals collectExtraPhaseActions args 
-       ( (getAttr ["flags"] defaults args) ++ passedOptionals);
-
-  chooseOptionsByFlags2 = flagConfig : collectExtraPhaseActions : args : flags :
-    let   
-        # helper function
-        collectFlags = # state : flags :
-              fold ( flag : s : (
-                     if (hasAttr flag s.result) then s # this state has already been visited
-                     else if (! hasAttr flag flagConfig) then throw "unkown flag `${flag}' specified"
-                           else let fDesc = (builtins.getAttr flag flagConfig);
-                                    implied = flatten ( getAttr ["implies"] [] fDesc );
-                                    blocked = flatten ( getAttr ["blocks"] [] fDesc ); 
-                                    # add this flag
-                                    s2 =  s // { result = ( setAttr s.result flag (builtins.getAttr flag flagConfig) );
-                                                 blockedFlagsBy = s.blockedFlagsBy 
-                                                   // listToAttrs (map (b: nv b flag ) blocked); };
-                                    # add implied flags
-                                in collectFlags s2 implied
-                   ));
-
-        # chosen contains flagConfig but only having those attributes elected by flags 
-        # (or by implies attributes of elected attributes)
-        options = let stateOpts = collectFlags { blockedFlagsBy = {}; result = {}; } 
-                                               (flags ++ ( if (hasAttr "mandatory" flagConfig) then ["mandatory"] else [] ));
-                      # these options have not been chosen (neither by flags nor by implies)
-                      unsetOptions = filter ( x : (! hasAttr x stateOpts.result) && (hasAttr ("no_"+x) flagConfig)) 
-                                            ( attrNames flagConfig );
-                      # no add the corresponding no_ attributes as well ..
-                      state = collectFlags stateOpts (map ( x : "no_" + x ) unsetOptions);
-                  in # check for blockings:
-                     assert ( all id ( map ( b: if (hasAttr b state.result) 
-                                             then throw "flag ${b} is blocked by flag ${__getAttr b state.blockedFlagsBy}"
-                                             else true ) 
-                                           (attrNames state.blockedFlagsBy) ) ); 
-                    state.result;
-        flatOptions = flattenAttrs options;
-
-        # helper functions :
-        collectAttrs = attr : catAttrs attr flatOptions;
-        optsConcatStrs = delimiter : attrs : concatStrings 
-                ( intersperse delimiter (flatten ( collectAttrs attrs ) ) );
-
-        ifStringGetArg = x : if (__isAttrs x) then x # ( TODO implement __isString ?)
-                             else nvs x (__getAttr x args);
-          
-    in assert ( all id ( mapRecordFlatten ( attr : r : if ( all id ( flatten (getAttr ["assertion"] [] r ) ) ) 
-                                              then true else throw "assertion failed flag ${attr}" )
-                                         options) );
-      ( rec {
-
-          #foldOptions = attr: f : start: fold f start (catAttrs attr flatOptions);
-
-          # compared to flags flagsSet does also contain the implied flags.. This makes it easy to write assertions. ( assert args.
-          inherit options flatOptions collectAttrs optsConcatStrs;
 
-          buildInputs = map ( attr: if (! hasAttr attr args) then throw "argument ${attr} is missing!" else (builtins.getAttr attr args) )
-                        (flatten  (catAttrs "buildInputs" flatOptions));
-          propagatedBuildInputs = map ( attr: if (! hasAttr attr args) then throw "argument ${attr} is missing!" else (builtins.getAttr attr args) )
-                        (flatten  (catAttrs "propagatedBuildInputs" flatOptions));
-
-          configureFlags = optsConcatStrs " " "cfgOption";
-
-          #flags = listToAttrs (map ( flag: nv flag (hasAttr flag options) ) (attrNames flagConfig) );
-          flags_prefixed = listToAttrs (map ( flag: nv ("flag_set_"+flag) (hasAttr flag options) ) (attrNames flagConfig) );
-
-          pass = mergeAttrs ( map ifStringGetArg ( flatten (collectAttrs "pass") ) );
-      } #  now add additional phase actions (see examples)
-      // listToAttrs ( map ( x : nv x (optsConcatStrs "\n" x) ) collectExtraPhaseActions ) );
 }
-
-/* 
-  TODO: Perhaps it's better to move this documentation / these tests into some extra packages ..
-
-  # ###########################################################################
-  #  configuration tutorial .. examples and tests.. 
-  #  Copy this into all-packages.nix and  try
-
-  # The following derviations will all fail.. 
-  # But they will print the passed options so that you can get to know
-  # how these configurations ought to work.
-  # TODO: There is no nice way to pass an otpion yet.
-  #       I could imagine something like
-  #       flags = [ "flagA" "flagB" { flagC = 4; } ];
-
-  # They are named:
-  # simpleYes, simpleNo, 
-  # defaultsimpleYes, defaultsimpleNo
-  # optionalssimpleYes, optionalssimpleNo
-  # bitingsimpleYes can only be ran with -iA  blockingBiteMonster
-  # assertionsimpleNo
-  # of course you can use -iA and the attribute name as well to select these examples
-
-  # dummy build input
-  whoGetsTheFlagFirst = gnused;
-  whoGetsTheFlagLast = gnumake;
-
-  # simple example demonstrating containing one flag.
-  # features:
-  # * configure options are passed automatically
-  # * buildInputs are collected (they are special, see the setup script)
-  # * they can be passed by additional name as well using pass = { inherit (args) python } 
-  #                                       ( or short (value not attrs) : pass = "python" )
-  # * an attribute named the same way as the flag is added indicating 
-  #   true/ false (flag has been set/ not set)
-  # * extra phase dependend commands can be added
-  #   Its easy to add your own stuff using co.collectAttrs or co.optsConcatStrs 
-  #   ( perhaps this name will change?)
-  simpleFlagYesNoF = namePrefix : extraFlagAttrs : mkDerivationByConfiguration ( {
-    flagConfig = {
-      flag    = { name = namePrefix + "simpleYes"; 
-                  cfgOption = [ "--Yes" "--you-dont-need-a-list" ]; 
-                  buildInputs = [ "whoGetsTheFlagFirst" ]; 
-                  pass = { inherit gnumake; };
-                  extraConfigureCmd = "echo Hello, it worked! ";
-                  blocks = "bitingMonster";
-                };
-      no_flag = { name = namePrefix + "simpleNo"; 
-                  cfgOption = "--no"; 
-                  implies = ["bitingMonster"];
-                };
-      bitingMonster = {
-                  extraConfigureCmd = "echo Ill bite you";
-                };
-      gnutar = { cfgOption="--with-gnutar";
-                  # buildInputs and pass will be added automatically if gnutar is added to optionals
-               };
-      # can be used to check configure options of dependencies
-      # eg testFlag = { assertion = [ arg.desktop.flag_set_wmii (! arg.desktop.flag_set_gnome) (! arg.desktops.flag_set_kde ]; }
-      assertionFlag = { assertion = false; }; # assert is nix language keyword
-                                        
-    }; 
-
-    collectExtraPhaseActions = [ "extraConfigureCmd" ];
-
-    extraAttrs = co : {
-      name = ( __head (co.collectAttrs "name") );
-
-      unpackPhase = "
-       echo my name is 
-       echo \$name
-       echo
-       echo flag given \\(should be 1 or empty string\\) ? 
-       echo \$flag_set_flag
-       echo
-       echo my build inputs are 
-       echo \$buildInputs
-       echo
-       echo my configuration flags are 
-       echo \$configureFlags
-       echo
-       echo what about gnumake? Did it pass?
-       echo \$gnumake
-       echo 
-       echo configurePhase command is
-       echo $\configurePhase
-       echo 
-       echo gnutar passed? \\(optional test\\)
-       echo \$gnutar
-       echo
-       echo dying now
-       echo die_Hopefully_Soon
-      ";
-    configurePhase = co.extraConfigureCmd;
-    };
-  } // extraFlagAttrs ); 
-
-
-  simpleYes = simpleFlagYesNoF "" {} {
-    inherit whoGetsTheFlagFirst lib stdenv;
-    flags = ["flag"];
-  };
-  # note the "I'll bite you" because of the implies attribute
-  simpleNo = simpleFlagYesNoF "" {} {
-    inherit whoGetsTheFlagFirst lib stdenv;
-    flags = [];
-  };
-
-  # specifying defaults by adding a default attribute
-  
-  yesAgainDefault = simpleFlagYesNoF "default" { defaults = [ "flag" ];} {
-    inherit whoGetsTheFlagFirst lib stdenv;
-  };
-  noAgainOverridingDefault = simpleFlagYesNoF "default" { defaults = [ "flag" ];} {
-    inherit whoGetsTheFlagFirst lib stdenv;
-    flags = [];
-  };
-
-  # requested by Michael Raskin: activate flag automatically if dependency is passed:
-  withGnutarOptional = simpleFlagYesNoF "optionals" { optionals = [ "gnutar" ];} {
-    flags = [ "flag" ]; # I only need to pass this to trigger name optionalssimpleYes
-    inherit whoGetsTheFlagFirst lib stdenv;
-    inherit gnutar;
-  };
-  withoutGnutarOptional = simpleFlagYesNoF "optionals" { optionals = [ "gnutar" ];} {
-    inherit whoGetsTheFlagFirst lib stdenv;
-  };
-
-  # blocking example, this shouldn't even start building:
-  blockingBiteMonster = simpleFlagYesNoF "biting" {} {
-    inherit whoGetsTheFlagFirst lib stdenv;
-    flags = [ "flag" "bitingMonster" ];
-  };
-
-  # assertion example this shouldn't even start building:
-  assertion = simpleFlagYesNoF "assertion" {} {
-    inherit whoGetsTheFlagFirst lib stdenv;
-    flags = [ "assertionFlag" ];
-  };
-*/
diff --git a/pkgs/misc/gxemul/default.nix b/pkgs/misc/gxemul/default.nix
index e7d0c92a1c561..548aad3bc27ae 100644
--- a/pkgs/misc/gxemul/default.nix
+++ b/pkgs/misc/gxemul/default.nix
@@ -1,34 +1,37 @@
-args: with args.lib; with args;
-let
-  name="gxemul-0.4.6";
-  co = chooseOptionsByFlags {
-    inherit args;
-    flagDescr = {
-      mandatory = { install = "ensureDir \$out/bin; cp gxemul \$out/bin;"; };
-      doc   = { install = "ensureDir \$out/share/${name}; cp -r doc \$out/share/${name};"; implies = "man"; };
-      demos = { install = "ensureDir \$out/share/${name}; cp -r demos \$out/share/${name};"; };
-      man   = { install = "cp -r ./man \$out/;";};
+args: with args;
+let edf = composableDerivation.edf;
+    name = "gxemul-0.4.6"; in
+composableDerivation.composableDerivation {
+
+  initial = {
+    inherit name;
+    flags = {
+        doc   = { installPhase = "ensureDir \$out/share/${name}; cp -r doc \$out/share/${name};"; implies = "man"; };
+        demos = { installPhase = "ensureDir \$out/share/${name}; cp -r demos \$out/share/${name};"; };
+        man   = { installPhase = "cp -r ./man \$out/;";};
     };
-    optionals = ["libX11"];
-    defaultFlags = [ "demos" "doc" ];
-  };
-in stdenv.mkDerivation {
 
-  inherit name;
-  inherit (co) /* flags */ buildInputs configureFlags;
+    cfg = {
+      docSupport = true;
+      demosSupport = true;
+      manSupport = true;
+    };
 
-  src = fetchurl {
-    url = http://gavare.se/gxemul/src/gxemul-0.4.6.tar.gz;
-    sha256 = "0hf3gi6hfd2qr5090zimfiddcjgank2q6m7dfsr81wwpxfbhb2z3";
-  };
+    installPhase = "ensureDir \$out/bin; cp gxemul \$out/bin;";
 
-  configurePhase="./configure";
+    src = fetchurl {
+      url = http://gavare.se/gxemul/src/gxemul-0.4.6.tar.gz;
+      sha256 = "0hf3gi6hfd2qr5090zimfiddcjgank2q6m7dfsr81wwpxfbhb2z3";
+    };
+
+    configurePhase="./configure";
 
-  installPhase = concatStrings ( catAttrs "install" co.flatOptions );
+    meta = {
+      license = "BSD";
+      description = "A Machine Emulator, Mainly emulates MIPS, but supports other CPU type";
+      homepage = http://gavare.se/gxemul/;
+    };
 
-  meta = {
-    license = "BSD";
-    description = "A Machine Emulator, Mainly emulates MIPS, but supports other CPU type";
-    homepage = http://gavare.se/gxemul/;
+    mergeAttrBy = { installPhase = a : b : "${a}\n${b}"; };
   };
 }
diff --git a/pkgs/misc/jackaudio/default.nix b/pkgs/misc/jackaudio/default.nix
index 7c4450a8a2bdd..c7c010963c54c 100644
--- a/pkgs/misc/jackaudio/default.nix
+++ b/pkgs/misc/jackaudio/default.nix
@@ -1,57 +1,53 @@
-# Perhaps we can get some ideas from here ? http://gentoo-wiki.com/HOWTO_Jack 
+# Perhaps we can get some ideas from here ? http://gentoo-wiki.com/HOWTO_Jack
 # still much to test but it compiles now
 args:
-args.mkDerivationByConfiguration {
-    flagConfig = {
-    mandatory = { buildInputs = [ "pkgconfig" ];};
-
-    # FIXME: tidy up
-
-    # static[=PKGS] =     { cfgOption = "--enable-static[=PKGS]"; };                  #build static libraries [default=no]
-    # shared[=PKGS] =     { cfgOption = "--enable-shared[=PKGS]"; };                  #build shared libraries [default=yes]
-    posix_shm =         { cfgOption = "--enable-posix-shm"; };                        #use POSIX shm API
-    # altivec seems to be for mac only ?
-    #  altivec =           { cfgOption = "--enable-altivec"; };                        #enable Altivec support (default=auto)
-
-    # keeping default values by now:
-    # optimization_by_compiler = { cfgOption = "--enable-optimization-by-compiler"; }; [>use compiler (NOT processor) capabilities to determine optimization flags
-    # optimization_by_cpu = { cfgOption = "--enable-optimization-by-cpu"; };          [>use processor capabilities to determine optimization flags
-
-    # I think the default is ok
-    # mmx =               { cfgOption = "--enable-mmx"; };                           #enable MMX support (default=auto)
-    #sse =               { cfgOption = "--enable-sse"; };                            #enable SSE support (default=auto)
-    #dynsimd =           { cfgOption = "--enable-dynsimd"; };                        #enable dynamic SIMD selection (default=no)
-    #optimize =          { cfgOption = "--enable-optimize"; };                       #ask the compiler for its best optimizations
-    #resize =            { cfgOption = "--enable-resize"; };                         #enable buffer resizing feature
-    #ensure_mlock =      { cfgOption = "--enable-ensure-mlock"; };                   #fail if unable to lock memory
-    #debug =             { cfgOption = "--enable-debug"; };                          #enable debugging messages in jackd and libjack
-    timestamps =        { cfgOption = "--enable-timestamps"; };                      # allow clients to use the JACK timestamp API
-    #preemption_check =  { cfgOption = "--enable-preemption-check"; };               #
-
-    capabilities =      { cfgOption = "--enable-capabilities"; };                   #use libcap to gain realtime scheduling priviledges
-    no_oldtrans =       { cfgOption = "--disable-oldtrans"; };                      #remove old transport interfaces
-    stripped_jackd =    { cfgOption = "--enable-stripped-jackd"; };                 #strip jack before computing its md5 sum
-    no_portaudio =      { cfgOption = "--disable-portaudio"; };                     #ignore PortAudio driver
-    no_coreaudio =      { cfgOption = "--disable-coreaudio"; };                     #ignore CoreAudio driver
-    no_oss =            { cfgOption = "--disable-oss"; };                           #ignore OSS driver
-    no_freebob =        { cfgOption = "--disable-freebob"; };                       #ignore FreeBob driver
-    alsa =              { cfgOption = "--enable-alsa"; buildInputs="alsaLib"; };        #enable ALSA driver
-    no_alsa =           { cfgOption = "--disable-alsa"; };                          #ignore ALSA driver
-
-    }; 
-
-    extraAttrs = co : {
-      name = "jack-0.103.0";
-
-      src = args.fetchurl {
-        url = "mirror://sourceforge/jackit/jack-audio-connection-kit-0.109.2.tar.gz";
-        sha256 = "1m5z8dzalqspsa63pkcgyns0cvh0kqwhb9g1ivcwvnz0bc7ag9r7";
-      };
-
-      meta = { 
-        description = "jack audio connection kit";
-        homepage = "http://jackaudio.org";
-        license = "GPL";
-      };
+let inherit (args.composableDerivation) composableDerivation edf; in
+composableDerivation {
+  initial = {
+    buildInputs = [ args.pkgconfig ];
+    flags =
+        # FIXME: tidy up
+         edf { name = "posix-shm"; } #use POSIX shm API
+      // edf { name = "timestamps"; }                      # allow clients to use the JACK timestamp API
+      // edf { name = "capabilities"; }                   #use libcap to gain realtime scheduling priviledges
+      // edf { name = "oldtrans"; }                      #remove old transport interfaces
+      // edf { name = "stripped-jackd"; }                 #strip jack before computing its md5 sum
+      // edf { name = "portaudio"; }                     #ignore PortAudio driver
+      // edf { name = "coreaudio"; }                     #ignore CoreAudio driver
+      // edf { name = "oss"; }                           #ignore OSS driver
+      // edf { name = "freebob"; }                       #ignore FreeBob driver
+      // edf { name = "alsa"; enable = { buildInputs=[args.alsaLib]; }; };
+
+      # altivec seems to be for mac only ?
+      #  altivec =           { configureFlags = ["--enable-altivec"]; };                        #enable Altivec support (default=auto)
+
+      # keeping default values by now:
+      # optimization_by_compiler = { configureFlags = ["--enable-optimization-by-compiler"]; }; [>use compiler (NOT processor) capabilities to determine optimization flags
+      # optimization_by_cpu = { configureFlags = ["--enable-optimization-by-cpu"]; };          [>use processor capabilities to determine optimization flags
+
+      # I think the default is ok
+      # mmx =              edf { name = "mmx"; };                           #enable MMX support (default=auto)
+      #sse =               edf { name = "sse"; };                            #enable SSE support (default=auto)
+      #dynsimd =           edf { name = "dynsimd"; };                        #enable dynamic SIMD selection (default=no)
+      #optimize =          edf { name = "optimize"; };                       #ask the compiler for its best optimizations
+      #resize =            edf { name = "resize"; };                         #enable buffer resizing feature
+      #ensure_mlock =      edf { name = "ensure-mlock"; };                   #fail if unable to lock memory
+      #debug =             edf { name = "debug"; };                          #enable debugging messages in jackd and libjack
+      #preemption_check =  edf { name = "preemption-check"; };               #
+    cfg = {
+      posix_shmSupport = true;
+      timestampsSupport = true;
+      alsaSupport = true;
+    };
+    name = "jack-0.103.0";
+    src = args.fetchurl {
+      url = "mirror://sourceforge/jackit/jack-audio-connection-kit-0.109.2.tar.gz";
+      sha256 = "1m5z8dzalqspsa63pkcgyns0cvh0kqwhb9g1ivcwvnz0bc7ag9r7";
+    };
+    meta = {
+      description = "jack audio connection kit";
+      homepage = "http://jackaudio.org";
+      license = "GPL";
+    };
     };
-} args
+}
diff --git a/pkgs/servers/squid/3.head.nix b/pkgs/servers/squid/3.head.nix
deleted file mode 100644
index 26f459525a864..0000000000000
--- a/pkgs/servers/squid/3.head.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-args:
-( args.mkDerivationByConfiguration {
-    flagConfig = {
-      mandatory = { buildInputs = [ "perl" ]; };
-      # many options I don't know wether they should be default .. 
-    }; 
-
-    extraAttrs = co : {
-      name = "squid-3.0-stable5";
-
-      src = args.fetchurl {
-	url = http://www.squid-cache.org/Versions/v3/HEAD/squid-3.HEAD-20080706.tar.bz2;
-        sha256 = "20f5994dd2189faa07edaef2c529f385e4590266d283745027b35d140eefe1ab";
-      };
-
-      configureFlags = ["--enable-ipv6"];
-
-      meta = { 
-        description = "http-proxy";
-        homepage = "http://www.squid-cache.org";
-        license = "GPL2";
-      };
-  };
-} ) args
diff --git a/pkgs/servers/squid/default.nix b/pkgs/servers/squid/default.nix
index 3ae7053f92949..95e922f5e95ef 100644
--- a/pkgs/servers/squid/default.nix
+++ b/pkgs/servers/squid/default.nix
@@ -1,24 +1,19 @@
-args:
-( args.mkDerivationByConfiguration {
-    flagConfig = {
-      mandatory = { buildInputs = [ "perl" ]; };
-      # many options I don't know wether they should be default .. 
-    }; 
+args: with args;
+stdenv.mkDerivation {
+  name = "squid-3.0-stable5";
 
-    extraAttrs = co : {
-      name = "squid-3.0-stable5";
+  buildInputs = [perl];
 
-      src = args.fetchurl {
-        url = http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE5.tar.bz2;
-        sha256 = "1m4ccpjw30q9vwsycmgg9dmhly0mpznvxrch6f7dxgfzpjp26l7w";
-      };
+  src = args.fetchurl {
+    url = http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE5.tar.bz2;
+    sha256 = "1m4ccpjw30q9vwsycmgg9dmhly0mpznvxrch6f7dxgfzpjp26l7w";
+  };
 
-      configureFlags = ["--enable-ipv6"];
+  configureFlags = ["--enable-ipv6"];
 
-      meta = { 
-        description = "http-proxy";
-        homepage = "http://www.squid-cache.org";
-        license = "GPL2";
-      };
+  meta = {
+    description = "http-proxy";
+    homepage = "http://www.squid-cache.org";
+    license = "GPL2";
   };
-} ) args
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 5a517e53992d6..f2cfd47bb76ea 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -251,25 +251,6 @@ let
     meta = (if drv ? meta then drv.meta else {}) // {priority = "10";};
   };
 
-  # documentation see examples in lib at end of file or read some use cases
-  # within this file
-  # Before spending much time on investigating how this works just ask me
-  # - Marc Weber (#irc or marco-oweber@gmx.de)
-  mkDerivationByConfiguration =
-    assert builtins ? isAttrs;
-    { flagConfig ? {}, optionals ? [], defaults ? []
-    , extraAttrs, collectExtraPhaseActions ? []
-    }:
-    args: with args.lib; with args;
-    if ( builtins.isAttrs extraAttrs ) then builtins.throw "the argument extraAttrs needs to be a function beeing passed co, but attribute set passed "
-    else
-    let co = lib.chooseOptionsByFlags { inherit args flagConfig optionals defaults collectExtraPhaseActions; }; in
-      args.stdenv.mkDerivation (
-      {
-        inherit (co) configureFlags buildInputs propagatedBuildInputs /*flags*/;
-      } // extraAttrs co  // co.pass // co.flags_prefixed );
-
-
   # Check absence of non-used options
   checker = x: flag: opts: config:
     (if flag then let result=(
@@ -474,20 +455,9 @@ let
     inherit pkgs;
   };
 
-  # see new python derivations for example..
-  # You should be able to override anything you like easily
-  composableDerivation = {
-          # modify args before applying stdenv.mkDerivation, this should remove at least attrs removeAttrsBy
-        f ? lib.prepareDerivationArgs,
-        stdenv ? pkgs.stdenv,
-          # initial set of arguments to be passed to stdenv.mkDerivation passing prepareDerivationArgs by default
-        initial ? {},
-          # example func :  (x: x // { x.buildInputs ++ ["foo"] }), but see mergeAttrByFunc which does this for you
-        merge ? (lib.mergeOrApply lib.mergeAttrByFunc)
-      }: lib.applyAndFun
-            (args: stdenv.mkDerivation (f args))
-            merge
-            (merge { inherit (lib) mergeAttrBy; } initial);
+  composableDerivation = (import ../lib/composable-derivation.nix) {
+    inherit pkgs lib;
+  };
 
   # Write the references (i.e. the runtime dependencies in the Nix store) of `path' to a file.
   writeReferencesToFile = path: runCommand "runtime-deps"
@@ -1801,9 +1771,9 @@ let
 
   #TODO add packages http://cvs.haskell.org/Hugs/downloads/2006-09/packages/ and test
   # commented out because it's using the new configuration style proposal which is unstable
-  #hugs = import ../development/compilers/hugs {
-    #inherit lib fetchurl stdenv;
-  #};
+  hugs = import ../development/compilers/hugs {
+    inherit lib fetchurl stdenv composableDerivation;
+  };
 
   j2sdk14x =
     assert system == "i686-linux";
@@ -1916,7 +1886,7 @@ let
   };
 
   roadsend = import ../development/compilers/roadsend {
-    inherit fetchurl stdenv flex bison mkDerivationByConfiguration bigloo lib curl;
+    inherit fetchurl stdenv flex bison bigloo lib curl composableDerivation;
     # optional features
     # all features pcre, fcgi xml mysql, sqlite3, (not implemented: odbc gtk gtk2)
     flags = ["pcre" "xml" "mysql"];
@@ -2085,13 +2055,9 @@ let
 
   php = import ../development/interpreters/php_configurable {
     inherit
-      stdenv fetchurl lib mkDerivationByConfiguration autoconf automake
+      stdenv fetchurl lib composableDerivation autoconf automake
       flex bison apacheHttpd mysql libxml2 # gettext
       zlib curl gd postgresql openssl pkgconfig;
-    flags = [
-      "xdebug" "mysql" "mysqli" "pdo_mysql" "libxml2" "apxs2" "curl"
-      "postgresql" "bcmath" "gd" "sockets" "curl"
-    ];
   };
 
   pltScheme = builderDefsPackage (import ../development/interpreters/plt-scheme) {
@@ -2279,10 +2245,9 @@ let
     inherit fetchurl stdenv perl autoconf;
   };
 
-  # commented out because it's using the new configuration style proposal which is unstable
-  #avrdude = import ../development/tools/misc/avrdude {
-  #  inherit lib fetchurl stdenv flex yacc;
-  #};
+  avrdude = import ../development/tools/misc/avrdude {
+    inherit lib fetchurl stdenv flex yacc composableDerivation texLive;
+  };
 
   binutils = useFromStdenv "binutils"
     (import ../development/tools/misc/binutils {
@@ -2873,9 +2838,9 @@ let
   };
 
   fltk20 = (import ../development/libraries/fltk) {
-    inherit mkDerivationByConfiguration x11 lib;
+    inherit composableDerivation x11 lib pkgconfig freeglut;
     inherit fetchurl stdenv mesa mesaHeaders libpng libjpeg zlib ;
-    inherit (xlibs) inputproto libXi;
+    inherit (xlibs) inputproto libXi libXinerama libXft;
     flags = [ "useNixLibs" "threads" "shared" "gl" ];
   };
 
@@ -2928,11 +2893,9 @@ let
   };
 
   geos = import ../development/libraries/geos {
-    inherit fetchurl fetchsvn stdenv mkDerivationByConfiguration autoconf automake libtool swig which lib;
+    inherit fetchurl fetchsvn stdenv autoconf
+      automake libtool swig which lib composableDerivation python ruby;
     use_svn = stdenv.system == "x86_64-linux";
-    python = python;
-    # optional features:
-    # python / ruby support
   };
 
   gettext = composedArgsAndFun (selectVersion ../development/libraries/gettext "0.17") {
@@ -3245,7 +3208,7 @@ let
   };
 
   libdv = import ../development/libraries/libdv {
-    inherit fetchurl stdenv lib mkDerivationByConfiguration;
+    inherit fetchurl stdenv lib composableDerivation;
   };
 
   libdrm = import ../development/libraries/libdrm {
@@ -3299,7 +3262,7 @@ let
   };
 
   libsamplerate = import ../development/libraries/libsamplerate {
-    inherit fetchurl stdenv mkDerivationByConfiguration pkgconfig lib;
+    inherit fetchurl stdenv pkgconfig lib;
   };
 
   libspectre = import ../development/libraries/libspectre {
@@ -5822,11 +5785,7 @@ let
   };
 
   squid = import ../servers/squid {
-    inherit fetchurl stdenv mkDerivationByConfiguration perl lib;
-  };
-
-  squidHead = import ../servers/squid/3.head.nix {
-    inherit fetchurl stdenv mkDerivationByConfiguration perl lib;
+    inherit fetchurl stdenv perl lib;
   };
 
   tomcat5 = import ../servers/http/tomcat {
@@ -7699,21 +7658,6 @@ let
     cddaSupport = true;
   };
 
-  # commented out because it's using the new configuration style proposal which is unstable
-  # should be the same as the nix expression above except support for esound :)
-  /*
-  MPlayer_new_config = import ../applications/video/MPlayer/newconfig.nix {
-    inherit fetchurl stdenv freetype x11 zlib freefont_ttf lib;
-    inherit (xlibs) libX11 xextproto;
-
-    # optional features
-    inherit alsaLib libtheora libcaca;
-    inherit (gnome) esound;
-    inherit (xlibs) libXv libXinerama;
-    inherit (xlibs) libXrandr; # FIXME does this option exist? I couldn't find it as configure option
-  };
-  */
-
   MPlayerPlugin = browser:
     import ../applications/networking/browsers/mozilla-plugins/mplayerplug-in {
       inherit browser;
@@ -7722,13 +7666,10 @@ let
       # !!! should depend on MPlayer
     };
 
-  # commented out because it's using the new configuration style proposal which is unstable
-  /*
   mrxvt = import ../applications/misc/mrxvt {
     inherit lib fetchurl stdenv;
     inherit (xlibs) libXaw xproto libXt libX11 libSM libICE;
   };
-  */
 
   multisync = import ../applications/misc/multisync {
     inherit fetchurl stdenv autoconf automake libtool pkgconfig;
@@ -7928,9 +7869,9 @@ let
   };
 
   sox = import ../applications/misc/audio/sox {
-    inherit fetchurl stdenv lib mkDerivationByConfiguration;
+    inherit fetchurl stdenv lib composableDerivation;
     # optional features
-    inherit alsaLib; # libao
+    inherit alsaLib libao;
     inherit libsndfile libogg flac libmad lame libsamplerate;
     # Using the default nix ffmpeg I get this error when linking
     # .libs/libsox_la-ffmpeg.o: In function `audio_decode_frame':
@@ -8096,7 +8037,7 @@ let
   };
 
   vim_configurable = import ../applications/editors/vim/configurable.nix {
-    inherit fetchurl stdenv ncurses pkgconfig mkDerivationByConfiguration lib;
+    inherit fetchurl stdenv ncurses pkgconfig composableDerivation lib;
     inherit (xlibs) libX11 libXext libSM libXpm
         libXt libXaw libXau libXmu;
     inherit (gtkLibs) glib gtk;
@@ -8314,12 +8255,11 @@ let
   };
 
   # doesn't compile yet - in case someone else want's to continue ..
-  /*
-  qgis_svn = import ../applications/misc/qgis_svn {
-    inherit mkDerivationByConfiguration fetchsvn stdenv flex lib
+  qgis =  composedArgsAndFun (selectVersion ../applications/misc/qgis "0.11.0") {
+    inherit composableDerivation fetchsvn stdenv flex lib
             ncurses fetchurl perl cmake gdal geos proj x11
             gsl libpng zlib bison
-            sqlite glibc fontconfig freetype / * use libc from stdenv ? - to lazy now - Marc * /;
+            sqlite glibc fontconfig freetype /* use libc from stdenv ? - to lazy now - Marc */;
     inherit (xlibs) libSM libXcursor libXinerama libXrandr libXrender;
     inherit (xorg) libICE;
     qt = qt4;
@@ -8327,7 +8267,6 @@ let
     # optional features
     # grass = "not yet supported" # cmake -D WITH_GRASS=TRUE  and GRASS_PREFX=..
   };
-  */
 
   zapping = import ../applications/video/zapping {
     inherit fetchurl stdenv pkgconfig perl python
@@ -8656,17 +8595,14 @@ let
     x11Support = true;
   }));
 
-  # commented out because it's using the new configuration style proposal which is unstable
-  /*
   gxemul = (import ../misc/gxemul) {
-    inherit lib stdenv fetchurl;
+    inherit lib stdenv fetchurl composableDerivation;
     inherit (xlibs) libX11;
   };
-  */
 
   # using the new configuration style proposal which is unstable
   jackaudio = import ../misc/jackaudio {
-    inherit mkDerivationByConfiguration
+    inherit composableDerivation
            ncurses lib stdenv fetchurl alsaLib pkgconfig;
     flags = [ "posix_shm" "timestamps" "alsa"];
   };