summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2009-03-16 12:45:27 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2009-03-16 12:45:27 +0000
commit3593b97d631d554cfec9a5eec8966fadb3192de8 (patch)
treec1a1f0bbb9270c83c803f501e14ea451e8f9fc74
parentd574d882ccade3b159b16e7ea2b8aeffd9d13bcd (diff)
parent808f12e36961b15c9662bb6e890f9045cdab43ce (diff)
downloadnixlib-3593b97d631d554cfec9a5eec8966fadb3192de8.tar
nixlib-3593b97d631d554cfec9a5eec8966fadb3192de8.tar.gz
nixlib-3593b97d631d554cfec9a5eec8966fadb3192de8.tar.bz2
nixlib-3593b97d631d554cfec9a5eec8966fadb3192de8.tar.lz
nixlib-3593b97d631d554cfec9a5eec8966fadb3192de8.tar.xz
nixlib-3593b97d631d554cfec9a5eec8966fadb3192de8.tar.zst
nixlib-3593b97d631d554cfec9a5eec8966fadb3192de8.zip
* Sync with the trunk.
svn path=/nixpkgs/branches/stdenv-updates/; revision=14557
-rw-r--r--doc/meta.xml16
-rw-r--r--pkgs/applications/audio/audacious/plugins.nix3
-rw-r--r--pkgs/applications/audio/aumix/default.nix6
-rw-r--r--pkgs/applications/audio/ladspa-plugins/default.nix4
-rw-r--r--pkgs/applications/audio/ladspa-plugins/ladspah.nix4
-rw-r--r--pkgs/applications/audio/vorbis-tools/default.nix7
-rw-r--r--pkgs/applications/display-managers/slim/default.nix26
-rw-r--r--pkgs/applications/display-managers/slim/pam.patch446
-rw-r--r--pkgs/applications/editors/emacs-modes/bbdb/default.nix3
-rw-r--r--pkgs/applications/editors/emacs-modes/cedet/default.nix48
-rw-r--r--pkgs/applications/editors/emacs-modes/eieio/default.nix2
-rw-r--r--pkgs/applications/editors/emacs-modes/quack/default.nix3
-rw-r--r--pkgs/applications/editors/emacs-modes/semantic/default.nix2
-rw-r--r--pkgs/applications/editors/emacs-unicode/default.nix25
-rw-r--r--pkgs/applications/editors/vim/configurable.nix126
-rw-r--r--pkgs/applications/editors/vim/ft-nix-support.patch66
-rw-r--r--pkgs/applications/editors/zile/default.nix43
-rw-r--r--pkgs/applications/graphics/gimp/default.nix6
-rw-r--r--pkgs/applications/graphics/gocr/0.44.nix4
-rw-r--r--pkgs/applications/graphics/inkscape/default.nix7
-rw-r--r--pkgs/applications/graphics/xscreensaver/default.nix6
-rw-r--r--pkgs/applications/misc/audio/sox/default.nix101
-rw-r--r--pkgs/applications/misc/djvulibre/default.nix10
-rw-r--r--pkgs/applications/misc/dmenu/default.nix8
-rw-r--r--pkgs/applications/misc/qgis/0.11.0.nix72
-rw-r--r--pkgs/applications/networking/browsers/firefox-3/default.nix10
-rw-r--r--pkgs/applications/networking/browsers/firefox-3/xulrunner.nix6
-rw-r--r--pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/builder.sh10
-rw-r--r--pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/default.nix15
-rw-r--r--pkgs/applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/default.nix63
-rw-r--r--pkgs/applications/networking/instant-messengers/pidgin/default.nix6
-rw-r--r--pkgs/applications/networking/irc/chatzilla/default.nix6
-rw-r--r--pkgs/applications/networking/mailreaders/thunderbird-3.x/default.nix105
-rw-r--r--pkgs/applications/networking/p2p/ldcpp/1.0.1.nix4
-rw-r--r--pkgs/applications/science/biology/ncbi-tools/default.nix19
-rw-r--r--pkgs/applications/science/biology/paml/default.nix9
-rw-r--r--pkgs/applications/version-management/arch/default.nix3
-rw-r--r--pkgs/applications/version-management/cvsps/default.nix11
-rw-r--r--pkgs/applications/version-management/git-and-tools/default.nix18
-rw-r--r--pkgs/applications/version-management/git-and-tools/git/default.nix6
-rw-r--r--pkgs/applications/version-management/git-and-tools/git/fill-paragraph.patch11
-rw-r--r--pkgs/applications/video/MPlayer/default.nix55
-rw-r--r--pkgs/applications/video/MPlayer/win32codecs/default.nix10
-rw-r--r--pkgs/applications/video/gnash/default.nix4
-rw-r--r--pkgs/applications/video/vlc/default.nix33
-rw-r--r--pkgs/applications/virtualization/qemu/svn-6642.nix19
-rw-r--r--pkgs/applications/window-managers/compiz/0.6.2.nix4
-rw-r--r--pkgs/applications/window-managers/compiz/0.7.8.nix4
-rw-r--r--pkgs/applications/window-managers/compiz/0.8.0.nix48
-rw-r--r--pkgs/applications/window-managers/fbpanel/4.12.nix4
-rw-r--r--pkgs/applications/window-managers/jwm/default.nix5
-rw-r--r--pkgs/applications/window-managers/wmii/default.nix6
-rwxr-xr-xpkgs/build-support/buildenv/builder.pl4
-rw-r--r--pkgs/build-support/buildenv/default.nix8
-rw-r--r--pkgs/build-support/fetchurl/mirrors.nix3
-rw-r--r--pkgs/build-support/make-wrapper/make-wrapper.sh2
-rw-r--r--pkgs/build-support/release/debian-build.nix17
-rw-r--r--pkgs/build-support/release/default.nix8
-rw-r--r--pkgs/build-support/release/make-source-tarball.nix13
-rw-r--r--pkgs/build-support/release/nix-build.nix21
-rw-r--r--pkgs/build-support/release/rpm-build.nix15
-rw-r--r--pkgs/build-support/vm/default.nix101
-rw-r--r--pkgs/build-support/vm/test.nix2
-rw-r--r--pkgs/data/documentation/man-pages/default.nix4
-rw-r--r--pkgs/data/documentation/rnrs/common.nix3
-rw-r--r--pkgs/data/fonts/clearlyU/1.9.nix4
-rw-r--r--pkgs/data/fonts/junicode/0.6.15.nix4
-rw-r--r--pkgs/data/fonts/ucs-fonts/default.nix4
-rw-r--r--pkgs/data/fonts/wqy_zenhei/0.4.23-1.nix4
-rw-r--r--pkgs/data/misc/poppler-data/default.nix4
-rw-r--r--pkgs/data/misc/shared-mime-info/0.22.nix2
-rw-r--r--pkgs/data/misc/shared-mime-info/0.23.nix2
-rw-r--r--pkgs/data/misc/shared-mime-info/common.nix16
-rw-r--r--pkgs/data/misc/shared-mime-info/default.nix17
-rw-r--r--pkgs/desktops/kde-3/kdebase/default.nix55
-rw-r--r--pkgs/desktops/kde-3/kdelibs/default.nix43
-rwxr-xr-xpkgs/desktops/kde-4-old/base/builder.sh (renamed from pkgs/desktops/kde-4/base/builder.sh)0
-rw-r--r--pkgs/desktops/kde-4-old/base/default.nix (renamed from pkgs/desktops/kde-4/base/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/decibel/default.nix (renamed from pkgs/desktops/kde-4/decibel/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/default.nix (renamed from pkgs/desktops/kde-4/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/edu/default.nix (renamed from pkgs/desktops/kde-4/edu/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/edu/myCmakeFiles/CheckBoostAndPythonCompatible.cmake (renamed from pkgs/desktops/kde-4/edu/myCmakeFiles/CheckBoostAndPythonCompatible.cmake)0
-rw-r--r--pkgs/desktops/kde-4-old/edu/myCmakeFiles/FindBoostPython.cmake (renamed from pkgs/desktops/kde-4/edu/myCmakeFiles/FindBoostPython.cmake)0
-rw-r--r--pkgs/desktops/kde-4-old/edu/myCmakeFiles/FindLibfacile.cmake (renamed from pkgs/desktops/kde-4/edu/myCmakeFiles/FindLibfacile.cmake)0
-rw-r--r--pkgs/desktops/kde-4-old/edu/myCmakeFiles/PythonLibsUtils.cmake (renamed from pkgs/desktops/kde-4/edu/myCmakeFiles/PythonLibsUtils.cmake)0
-rw-r--r--pkgs/desktops/kde-4-old/extragear/default.nix (renamed from pkgs/desktops/kde-4/extragear/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/games/default.nix (renamed from pkgs/desktops/kde-4/games/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/graphics/default.nix (renamed from pkgs/desktops/kde-4/graphics/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/libs/FindIlmBase.cmake (renamed from pkgs/desktops/kde-4/libs/FindIlmBase.cmake)0
-rw-r--r--pkgs/desktops/kde-4-old/libs/FindOpenEXR.cmake (renamed from pkgs/desktops/kde-4/libs/FindOpenEXR.cmake)0
-rw-r--r--pkgs/desktops/kde-4-old/libs/default.nix (renamed from pkgs/desktops/kde-4/libs/default.nix)0
-rwxr-xr-xpkgs/desktops/kde-4-old/libs/setup.sh (renamed from pkgs/desktops/kde-4/libs/setup.sh)0
-rw-r--r--pkgs/desktops/kde-4-old/multimedia/default.nix (renamed from pkgs/desktops/kde-4/multimedia/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/network/default.nix (renamed from pkgs/desktops/kde-4/network/default.nix)0
-rwxr-xr-xpkgs/desktops/kde-4-old/pim/builder.sh (renamed from pkgs/desktops/kde-4/pim/builder.sh)0
-rw-r--r--pkgs/desktops/kde-4-old/pim/default.nix (renamed from pkgs/desktops/kde-4/pim/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/pimlibs/default.nix (renamed from pkgs/desktops/kde-4/pimlibs/default.nix)0
-rwxr-xr-xpkgs/desktops/kde-4-old/runtime/builder.sh (renamed from pkgs/desktops/kde-4/runtime/builder.sh)0
-rw-r--r--pkgs/desktops/kde-4-old/runtime/default.nix (renamed from pkgs/desktops/kde-4/runtime/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/akode.nix (renamed from pkgs/desktops/kde-4/support/akode.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/default.nix (renamed from pkgs/desktops/kde-4/support/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/eigen.nix (renamed from pkgs/desktops/kde-4/support/eigen.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/gmm.nix (renamed from pkgs/desktops/kde-4/support/gmm.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/qca.nix (renamed from pkgs/desktops/kde-4/support/qca.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/qimageblitz.nix (renamed from pkgs/desktops/kde-4/support/qimageblitz.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/soprano.nix (renamed from pkgs/desktops/kde-4/support/soprano.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/strigi.nix (renamed from pkgs/desktops/kde-4/support/strigi.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/support/taglib.nix (renamed from pkgs/desktops/kde-4/support/taglib.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/toys/default.nix (renamed from pkgs/desktops/kde-4/toys/default.nix)0
-rw-r--r--pkgs/desktops/kde-4-old/utils/default.nix (renamed from pkgs/desktops/kde-4/utils/default.nix)0
-rwxr-xr-xpkgs/desktops/kde-4-old/workspace/builder.sh (renamed from pkgs/desktops/kde-4/workspace/builder.sh)0
-rw-r--r--pkgs/desktops/kde-4-old/workspace/default.nix (renamed from pkgs/desktops/kde-4/workspace/default.nix)0
-rw-r--r--pkgs/desktops/kde-4.2/admin/builder.sh13
-rw-r--r--pkgs/desktops/kde-4.2/admin/default.nix16
-rw-r--r--pkgs/desktops/kde-4.2/artwork/default.nix12
-rw-r--r--pkgs/desktops/kde-4.2/base-runtime/default.nix13
-rw-r--r--pkgs/desktops/kde-4.2/base-workspace/default.nix17
-rw-r--r--pkgs/desktops/kde-4.2/base/default.nix12
-rw-r--r--pkgs/desktops/kde-4.2/bindings/builder.sh11
-rw-r--r--pkgs/desktops/kde-4.2/bindings/default.nix16
-rw-r--r--pkgs/desktops/kde-4.2/default.nix152
-rw-r--r--pkgs/desktops/kde-4.2/edu/default.nix13
-rw-r--r--pkgs/desktops/kde-4.2/games/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/graphics/default.nix14
-rw-r--r--pkgs/desktops/kde-4.2/libs/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/multimedia/default.nix12
-rw-r--r--pkgs/desktops/kde-4.2/network/default.nix17
-rw-r--r--pkgs/desktops/kde-4.2/pim/builder.sh8
-rw-r--r--pkgs/desktops/kde-4.2/pim/default.nix16
-rw-r--r--pkgs/desktops/kde-4.2/pimlibs/default.nix12
-rw-r--r--pkgs/desktops/kde-4.2/plasma-addons/builder.sh9
-rw-r--r--pkgs/desktops/kde-4.2/plasma-addons/default.nix15
-rw-r--r--pkgs/desktops/kde-4.2/sdk/builder.sh8
-rw-r--r--pkgs/desktops/kde-4.2/sdk/default.nix15
-rw-r--r--pkgs/desktops/kde-4.2/support/akonadi/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/support/decibel/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/support/eigen/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/support/phonon/default.nix6
-rw-r--r--pkgs/desktops/kde-4.2/support/qca2/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/support/qimageblitz/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/support/soprano/default.nix6
-rw-r--r--pkgs/desktops/kde-4.2/toys/default.nix10
-rw-r--r--pkgs/desktops/kde-4.2/utils/builder.sh13
-rw-r--r--pkgs/desktops/kde-4.2/utils/default.nix15
-rw-r--r--pkgs/desktops/kde-4.2/webdev/default.nix12
-rw-r--r--pkgs/development/compilers/fpc/binary.nix13
-rw-r--r--pkgs/development/compilers/fpc/default.nix40
-rw-r--r--pkgs/development/compilers/fpc/lazarus.nix6
-rw-r--r--pkgs/development/compilers/gcc-upc-4.0/default.nix8
-rw-r--r--pkgs/development/compilers/ghcs/default.nix2
-rw-r--r--pkgs/development/compilers/gprolog/default.nix57
-rw-r--r--pkgs/development/compilers/hugs/default.nix92
-rw-r--r--pkgs/development/compilers/qi/9.1.nix4
-rw-r--r--pkgs/development/compilers/roadsend/default.nix58
-rw-r--r--pkgs/development/guile-modules/guile-lib/default.nix3
-rw-r--r--pkgs/development/interpreters/maude/default.nix2
-rw-r--r--pkgs/development/interpreters/php_configurable/default.nix295
-rw-r--r--pkgs/development/interpreters/python-new/2.5/default.nix172
-rw-r--r--pkgs/development/interpreters/python-new/2.5/python.nix7
-rw-r--r--pkgs/development/libraries/ConsoleKit/default.nix10
-rw-r--r--pkgs/development/libraries/SDL_image/default.nix11
-rw-r--r--pkgs/development/libraries/SDL_mixer/default.nix11
-rw-r--r--pkgs/development/libraries/SDL_net/default.nix11
-rw-r--r--pkgs/development/libraries/SDL_ttf/default.nix15
-rw-r--r--pkgs/development/libraries/chmlib/default.nix12
-rw-r--r--pkgs/development/libraries/faad2/default.nix23
-rw-r--r--pkgs/development/libraries/ffmpeg/default.nix32
-rw-r--r--pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix11
-rw-r--r--pkgs/development/libraries/fftw/default.nix4
-rw-r--r--pkgs/development/libraries/fltk/default.nix72
-rw-r--r--pkgs/development/libraries/fmod/default.nix28
-rw-r--r--pkgs/development/libraries/fribidi/default.nix12
-rw-r--r--pkgs/development/libraries/geos/default.nix53
-rw-r--r--pkgs/development/libraries/lcms/default.nix12
-rw-r--r--pkgs/development/libraries/libao/default.nix8
-rw-r--r--pkgs/development/libraries/libcv/default.nix2
-rw-r--r--pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix6
-rw-r--r--pkgs/development/libraries/libdbi/0.8.2.nix6
-rw-r--r--pkgs/development/libraries/libdv/default.nix43
-rw-r--r--pkgs/development/libraries/libdvdcss/default.nix12
-rw-r--r--pkgs/development/libraries/libdvdnav/default.nix24
-rw-r--r--pkgs/development/libraries/libdvdread/default.nix28
-rw-r--r--pkgs/development/libraries/libextractor/0.5.18.nix6
-rw-r--r--pkgs/development/libraries/libical/default.nix10
-rw-r--r--pkgs/development/libraries/libidn/default.nix50
-rw-r--r--pkgs/development/libraries/libixp_for_wmii/default.nix8
-rw-r--r--pkgs/development/libraries/libksba/default.nix24
-rw-r--r--pkgs/development/libraries/libmad/default.nix2
-rw-r--r--pkgs/development/libraries/libmsn/default.nix10
-rw-r--r--pkgs/development/libraries/liboil/0.3.13.nix3
-rw-r--r--pkgs/development/libraries/liboil/0.3.15.nix3
-rw-r--r--pkgs/development/libraries/libwmf/default.nix14
-rw-r--r--pkgs/development/libraries/lzo/default.nix27
-rw-r--r--pkgs/development/libraries/mpich2/default.nix12
-rw-r--r--pkgs/development/libraries/openbabel/default.nix17
-rw-r--r--pkgs/development/libraries/poppler/default.nix36
-rw-r--r--pkgs/development/libraries/qt-4/default.nix2
-rw-r--r--pkgs/development/libraries/sqlite/default.nix14
-rw-r--r--pkgs/development/libraries/tapioca-qt/default.nix22
-rw-r--r--pkgs/development/libraries/telepathy-qt/default.nix22
-rw-r--r--pkgs/development/libraries/vxl/default.nix6
-rw-r--r--pkgs/development/libraries/wxGTK-2.8/default.nix5
-rw-r--r--pkgs/development/misc/avr-gcc-with-avr-libc/default.nix74
-rw-r--r--pkgs/development/misc/avr8-burn-omat/default.nix32
-rw-r--r--pkgs/development/misc/bleeding-edge-repos/default.nix2
-rw-r--r--pkgs/development/perl-modules/Compress-Raw-Bzip2/default.nix15
-rw-r--r--pkgs/development/perl-modules/catalyst-fix-chunked-encoding.patch23
-rw-r--r--pkgs/development/python-modules/pycups/default.nix11
-rw-r--r--pkgs/development/python-modules/pygame/default.nix4
-rw-r--r--pkgs/development/python-modules/pyqt/default.nix11
-rw-r--r--pkgs/development/python-modules/python-sip/default.nix11
-rw-r--r--pkgs/development/python-modules/pyxml/default.nix3
-rw-r--r--pkgs/development/python-modules/rhpl/builder.sh12
-rw-r--r--pkgs/development/python-modules/rhpl/default.nix12
-rw-r--r--pkgs/development/python-modules/stringtemplate/default.nix (renamed from pkgs/tools/text/py-string-template/default.nix)6
-rw-r--r--pkgs/development/tools/analysis/valgrind/default.nix8
-rw-r--r--pkgs/development/tools/build-managers/cmake/2.6.3.nix31
-rw-r--r--pkgs/development/tools/build-managers/cmake/default.nix24
-rwxr-xr-xpkgs/development/tools/build-managers/cmake/setup-hook.sh55
-rw-r--r--pkgs/development/tools/documentation/doxygen/default.nix39
-rw-r--r--pkgs/development/tools/documentation/doxygen/tmake.patch23
-rw-r--r--pkgs/development/tools/guile/g-wrap/default.nix4
-rw-r--r--pkgs/development/tools/guile/guile-lint/default.nix3
-rw-r--r--pkgs/development/tools/misc/avrdude/default.nix42
-rw-r--r--pkgs/development/tools/misc/indent/2.2.9.nix4
-rw-r--r--pkgs/development/tools/misc/ltrace/0.5-3deb.nix4
-rw-r--r--pkgs/development/tools/misc/sloccount/default.nix51
-rw-r--r--pkgs/development/tools/parsing/antlr/antlr-2.7.6.nix5
-rw-r--r--pkgs/development/tools/parsing/antlr/builder2.sh16
-rw-r--r--pkgs/development/tools/parsing/ragel/default.nix60
-rw-r--r--pkgs/games/construo/0.2.2.nix4
-rw-r--r--pkgs/games/extremetuxracer/default.nix31
-rw-r--r--pkgs/games/fsg/alt-builder.nix6
-rw-r--r--pkgs/games/fsg/default.nix38
-rw-r--r--pkgs/games/gemrb/default.nix3
-rw-r--r--pkgs/games/neverball/default.nix33
-rw-r--r--pkgs/games/orbit/1.01.nix4
-rw-r--r--pkgs/games/scummvm/default.nix6
-rw-r--r--pkgs/games/teeworlds/default.nix4
-rw-r--r--pkgs/games/tuxracer/default.nix31
-rw-r--r--pkgs/games/wesnoth/default.nix9
-rw-r--r--pkgs/games/zdoom/default.nix29
-rw-r--r--pkgs/lib/attrsets.nix92
-rw-r--r--pkgs/lib/composable-derivation.nix25
-rw-r--r--pkgs/lib/debug.nix27
-rw-r--r--pkgs/lib/misc-tests.nix53
-rw-r--r--pkgs/lib/misc.nix135
-rw-r--r--pkgs/lib/options.nix412
-rw-r--r--pkgs/lib/strings.nix6
-rw-r--r--pkgs/lib/tests.nix8
-rw-r--r--pkgs/misc/emulators/dosbox/default.nix15
-rw-r--r--pkgs/misc/emulators/wine/default.nix8
-rw-r--r--pkgs/misc/ghc68extraLibs/default.nix2
-rw-r--r--pkgs/misc/gxemul/default.nix50
-rw-r--r--pkgs/misc/jackaudio/default.nix88
-rw-r--r--pkgs/os-specific/linux/acpi/default.nix10
-rw-r--r--pkgs/os-specific/linux/acpitool/default.nix7
-rw-r--r--pkgs/os-specific/linux/atheros/0.9.3.3.nix4
-rw-r--r--pkgs/os-specific/linux/atheros/0.9.4.nix4
-rw-r--r--pkgs/os-specific/linux/atheros/r2756.nix4
-rw-r--r--pkgs/os-specific/linux/atheros/r3122.nix4
-rw-r--r--pkgs/os-specific/linux/atheros/r3574.nix4
-rw-r--r--pkgs/os-specific/linux/atheros/r3693.nix4
-rw-r--r--pkgs/os-specific/linux/atheros/r3837.nix4
-rw-r--r--pkgs/os-specific/linux/atheros/r3867.nix4
-rw-r--r--pkgs/os-specific/linux/cryptsetup/default.nix23
-rw-r--r--pkgs/os-specific/linux/dmidecode/2.9.nix4
-rw-r--r--pkgs/os-specific/linux/kernel-headers/2.6.28.nix11
-rw-r--r--pkgs/os-specific/linux/kernel/builder.sh10
-rw-r--r--pkgs/os-specific/linux/kernel/config-2.6.27-i686-smp2
-rw-r--r--pkgs/os-specific/linux/kernel/config-2.6.28-i686-smp2
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.27.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-2.6.28.nix4
-rw-r--r--pkgs/os-specific/linux/kqemu/1.3.0pre11.nix17
-rw-r--r--pkgs/os-specific/linux/kqemu/1.4.0pre1.nix15
-rw-r--r--pkgs/os-specific/linux/kvm/84.nix (renamed from pkgs/os-specific/linux/kvm/82.nix)8
-rw-r--r--pkgs/os-specific/linux/nvidia/default.nix1
-rw-r--r--pkgs/os-specific/linux/powertop/default.nix10
-rw-r--r--pkgs/os-specific/linux/sdparm/1.03.nix4
-rw-r--r--pkgs/os-specific/linux/tcp-wrapper/builder.sh62
-rw-r--r--pkgs/os-specific/linux/tcp-wrapper/default.nix28
-rw-r--r--pkgs/os-specific/linux/tunctl/default.nix21
-rw-r--r--pkgs/servers/dict/1.9.15.nix4
-rw-r--r--pkgs/servers/dict/dictd-db.nix4
-rw-r--r--pkgs/servers/gpm/1.20.6.nix (renamed from pkgs/servers/gpm/1.20.3pre6.nix)4
-rw-r--r--pkgs/servers/irc/ircd-hybrid/default.nix10
-rw-r--r--pkgs/servers/sql/mysql5/default.nix6
-rw-r--r--pkgs/servers/squid/squids.nix36
-rw-r--r--pkgs/servers/xmpp/openfire/3.4.5.nix6
-rw-r--r--pkgs/servers/xmpp/openfire/3.5.2.nix6
-rw-r--r--pkgs/tools/X11/x11vnc/0.9.3.nix6
-rw-r--r--pkgs/tools/X11/x2vnc/1.7.2.nix4
-rw-r--r--pkgs/tools/admin/tightvnc/default.nix3
-rw-r--r--pkgs/tools/backup/rsnapshot/default.nix3
-rw-r--r--pkgs/tools/graphics/graphviz/default.nix8
-rw-r--r--pkgs/tools/graphics/netpbm/default.nix38
-rw-r--r--pkgs/tools/graphics/ploticus/default.nix3
-rw-r--r--pkgs/tools/misc/bogofilter/default.nix12
-rw-r--r--pkgs/tools/misc/desktop-file-utils/default.nix10
-rw-r--r--pkgs/tools/misc/idutils/default.nix2
-rw-r--r--pkgs/tools/misc/idutils/nix-mapping.patch10
-rw-r--r--pkgs/tools/misc/parted/default.nix16
-rw-r--r--pkgs/tools/misc/relfs/cvs.2007.12.01.nix4
-rw-r--r--pkgs/tools/misc/relfs/cvs.2008.03.05.nix4
-rw-r--r--pkgs/tools/misc/remind/default.nix15
-rw-r--r--pkgs/tools/misc/rlwrap/0.28.nix4
-rw-r--r--pkgs/tools/misc/system-config-printer/default.nix16
-rw-r--r--pkgs/tools/misc/testdisk/default.nix6
-rw-r--r--pkgs/tools/misc/timidity/default.nix27
-rw-r--r--pkgs/tools/misc/wv/default.nix14
-rw-r--r--pkgs/tools/networking/lsh/default.nix11
-rw-r--r--pkgs/tools/networking/lsh/pam-service-name.patch14
-rw-r--r--pkgs/tools/networking/nc6/1.0.nix4
-rw-r--r--pkgs/tools/networking/ncat/default.nix15
-rw-r--r--pkgs/tools/networking/nylon/default.nix19
-rw-r--r--pkgs/tools/networking/p2p/libtorrent/default.nix4
-rw-r--r--pkgs/tools/networking/p2p/rtorrent/default.nix4
-rw-r--r--pkgs/tools/networking/smbfs-fuse/0.8.7.nix10
-rw-r--r--pkgs/tools/networking/stunnel/default.nix18
-rw-r--r--pkgs/tools/package-management/dpkg/default.nix6
-rw-r--r--pkgs/tools/package-management/nix/unstable.nix8
-rw-r--r--pkgs/tools/security/gnupg2/default.nix6
-rw-r--r--pkgs/tools/security/seccure/0.3.nix4
-rw-r--r--pkgs/tools/security/ssss/0.5.nix4
-rw-r--r--pkgs/tools/security/sudo/default.nix8
-rw-r--r--pkgs/tools/system/at/default.nix6
-rw-r--r--pkgs/tools/system/filelight/default.nix19
-rw-r--r--pkgs/tools/system/gdmap/0.7.5.nix4
-rw-r--r--pkgs/tools/system/gdmap/0.8.1.nix6
-rw-r--r--pkgs/tools/system/pciutils/builder.sh10
-rw-r--r--pkgs/tools/system/pciutils/default.nix19
-rw-r--r--pkgs/tools/system/ts/default.nix6
-rw-r--r--pkgs/tools/typesetting/asciidoc/default.nix7
-rw-r--r--pkgs/tools/typesetting/docbook2x/default.nix8
-rw-r--r--pkgs/tools/typesetting/rubber/default.nix32
-rw-r--r--pkgs/top-level/all-packages.nix513
-rw-r--r--pkgs/top-level/build-for-release.nix28
-rw-r--r--pkgs/top-level/make-tarball.nix75
-rw-r--r--pkgs/top-level/release.nix236
339 files changed, 4931 insertions, 2358 deletions
diff --git a/doc/meta.xml b/doc/meta.xml
index 5e53609a2368..35308f2da950 100644
--- a/doc/meta.xml
+++ b/doc/meta.xml
@@ -64,10 +64,18 @@ interpretation:</para>
   <varlistentry>
     <term><varname>description</varname></term>
     <listitem><para>A short (one-line) description of the package.
-    Don’t include a period at the end.  This is shown by
-    <command>nix-env -q --description</command> and also on the
-    Nixpkgs release pages.  Example: <literal>"A program that produces
-    a familiar, friendly greeting"</literal></para></listitem>
+    This is shown by <command>nix-env -q --description</command> and
+    also on the Nixpkgs release pages.</para>
+
+    <para>Don’t include a period at the end.  Don’t include newline
+    characters.  Capitalise the first character.  For brevity, don’t
+    repeat the name of package — just describe what it does.</para>
+
+    <para>Wrong: <literal>"libpng is a library that allows you to decode PNG images."</literal></para>
+
+    <para>Right: <literal>"A library for decoding PNG images"</literal></para>
+
+    </listitem>
   </varlistentry>
 
   <varlistentry>
diff --git a/pkgs/applications/audio/audacious/plugins.nix b/pkgs/applications/audio/audacious/plugins.nix
index 3de5865d0d90..3fc093a69b39 100644
--- a/pkgs/applications/audio/audacious/plugins.nix
+++ b/pkgs/applications/audio/audacious/plugins.nix
@@ -23,6 +23,9 @@ stdenv.mkDerivation {
 
   NIX_LDFLAGS = "-L${audacious}/lib/audacious"; # needed because we override pluginlibdir
 
+  # `--enable-amidiplug' is to prevent configure from looking in /proc/asound.
+  configureFlags = "--enable-amidiplug";
+  
   meta = {
     description = "Plugins for the Audacious media player";
     homepage = http://audacious-media-player.org/;
diff --git a/pkgs/applications/audio/aumix/default.nix b/pkgs/applications/audio/aumix/default.nix
index 57c690fee9bc..9a8a75600889 100644
--- a/pkgs/applications/audio/aumix/default.nix
+++ b/pkgs/applications/audio/aumix/default.nix
@@ -16,8 +16,10 @@ stdenv.mkDerivation {
     ++ (if gtkGUI then [pkgconfig gtk] else []);
 
   meta = {
-    description = ''Aumix adjusts an audio mixer from X, the console,
-    		    a terminal, the command line or a script.'';
+    longDescription = ''
+      Aumix adjusts an audio mixer from X, the console, a terminal,
+      the command line or a script.
+    '';
     homepage = http://www.jpj.net/~trevor/aumix.html;
     license = "GPL";
   };
diff --git a/pkgs/applications/audio/ladspa-plugins/default.nix b/pkgs/applications/audio/ladspa-plugins/default.nix
index 8dd783a2d1af..6a0dfe020d0a 100644
--- a/pkgs/applications/audio/ladspa-plugins/default.nix
+++ b/pkgs/applications/audio/ladspa-plugins/default.nix
@@ -21,9 +21,7 @@ stdenv.mkDerivation {
 		(textClosure localDefs [doConfigure doMakeInstall 
 			postInstall doForceShare]);
 	meta = {
-		description = "
-	LADSPA format audio plugins.
-";
+		description = "LADSPA format audio plugins";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/audio/ladspa-plugins/ladspah.nix b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
index dd3286081555..1e29eadcadae 100644
--- a/pkgs/applications/audio/ladspa-plugins/ladspah.nix
+++ b/pkgs/applications/audio/ladspa-plugins/ladspah.nix
@@ -22,9 +22,7 @@ stdenv.mkDerivation {
 	builder = writeScript "ladspa.h-builder"
 		(textClosure localDefs [copyFile]);
 	meta = {
-		description = "
-	LADSPA format audio plugins.
-";
+		description = "LADSPA format audio plugins";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/audio/vorbis-tools/default.nix b/pkgs/applications/audio/vorbis-tools/default.nix
index 626dc1c9d96c..91d9ba00a0f5 100644
--- a/pkgs/applications/audio/vorbis-tools/default.nix
+++ b/pkgs/applications/audio/vorbis-tools/default.nix
@@ -15,9 +15,10 @@ stdenv.mkDerivation {
   patches = [ ./ogg123-curlopt-mute.patch ];
 
   meta = {
-    description = ''A set of command-line tools to manipulate Ogg Vorbis
-                    audio files, notably the `ogg123' player and the
-		    `oggenc' encoder.'';
+    longDescription = ''
+      A set of command-line tools to manipulate Ogg Vorbis audio
+      files, notably the `ogg123' player and the `oggenc' encoder.
+    '';
     homepage = http://xiph.org/vorbis/;
     license = "GPLv2";
   };
diff --git a/pkgs/applications/display-managers/slim/default.nix b/pkgs/applications/display-managers/slim/default.nix
index 5b711111c917..7ce261fec294 100644
--- a/pkgs/applications/display-managers/slim/default.nix
+++ b/pkgs/applications/display-managers/slim/default.nix
@@ -1,25 +1,33 @@
 {stdenv, fetchurl, x11, libjpeg, libpng, libXmu, freetype, pam}:
 
-stdenv.mkDerivation {
-  name = "slim-1.2.6";
+stdenv.mkDerivation rec {
+  name = "slim-1.3.1";
+
   src = fetchurl {
-    url = http://download.berlios.de/slim/slim-1.2.6.tar.gz;
-    sha256 = "0plcmm955rnv67sx67ka6dccanr4rfzwzvsj6lnr8kqdip4522jg";
+    url = "http://download.berlios.de/slim/${name}.tar.gz";
+    sha256 = "0xqgzvg6h1bd29140mcgg9r16vcmskz7zmym7i7jlz7x9c1a9mxc";
   };
+
   patches = [
     # Allow the paths of the configuration file and theme directory to
     # be set at runtime.
     ./runtime-paths.patch
-    # PAM support from
-    # http://developer.berlios.de/patch/?func=detailpatch&patch_id=1979&group_id=2663
+
+    # Fix a bug in slim's PAM support: the "resp" argument to the
+    # conversation function is a pointer to a pointer to an array of
+    # pam_response structures, not a pointer to an array of pointers to
+    # pam_response structures.  Of course C can't tell the difference...
     ./pam.patch
   ];
+
   buildInputs = [x11 libjpeg libpng libXmu freetype pam];
+
   NIX_CFLAGS_COMPILE = "-I${freetype}/include/freetype2";
-  preBuild = "
+
+  preBuild = ''
     substituteInPlace Makefile --replace /usr /no-such-path
-    makeFlagsArray=(CC=gcc CXX=g++ PREFIX=$out MANDIR=$out/share/man CFGDIR=$out/etc)
-  ";
+    makeFlagsArray=(CC=gcc CXX=g++ PREFIX=$out MANDIR=$out/share/man CFGDIR=$out/etc USE_PAM=1)
+  '';
 
   meta = {
     homepage = http://slim.berlios.de;
diff --git a/pkgs/applications/display-managers/slim/pam.patch b/pkgs/applications/display-managers/slim/pam.patch
index 68b86f51ba56..2163d20a5e32 100644
--- a/pkgs/applications/display-managers/slim/pam.patch
+++ b/pkgs/applications/display-managers/slim/pam.patch
@@ -1,369 +1,89 @@
-diff -rc slim-1.2.6-orig/app.cpp slim-1.2.6/app.cpp
-*** slim-1.2.6-orig/app.cpp	2006-09-15 23:00:37.000000000 +0200
---- slim-1.2.6/app.cpp	2007-06-05 12:45:58.000000000 +0200
+diff -rc slim-1.3.1-orig/app.cpp slim-1.3.1/app.cpp
+*** slim-1.3.1-orig/app.cpp	2008-09-26 02:54:15.000000000 +0200
+--- slim-1.3.1/app.cpp	2009-02-17 19:50:06.000000000 +0100
 ***************
-*** 25,30 ****
---- 25,68 ----
-  #include "app.h"
-  #include "numlock.h"
-  
-+ #ifdef USE_PAM
-+ #include <security/pam_appl.h>
-+ #include <security/pam_misc.h>
-+ #include <string>
-+ 
-+ pam_handle_t* pamh;
-+ char const* PAM_service = "slim"; // <----- Change this, if the patch gets accepted upstream
-+ string password;
-+ 
-+ int conv(int num_msg, const struct pam_message **msg,
-+          struct pam_response **resp, void *appdata_ptr){
-+     *resp = (struct pam_response *) calloc(num_msg, sizeof(struct pam_response));
-+     for (int i=0; i<num_msg; i++){
-+         resp[i]->resp_retcode=0;
-+         switch(msg[i]->msg_style){
-+             case PAM_PROMPT_ECHO_ON:
-+                 // We assume PAM is asking for the username
-+ 				// As we should have given that already, this should never happen
-+ 				cerr << APPNAME << ": PAM send an unexpected PAM_PROMPT_ECHO_ON" << endl;
-+ 				cerr << APPNAME << ": " << msg[i]->msg << endl;
-+                 break;
-+ 
-+             case PAM_PROMPT_ECHO_OFF:
-+                 // We assume PAM is asking for the password
-+                 resp[i]->resp=x_strdup(password.c_str());
-+                 break;
-+ 
-+             case PAM_ERROR_MSG:
-+             case PAM_TEXT_INFO:
-+                 // We simply right these to the log
-+                 // TODO: Maybe we should simply ignore them
-+                 cerr << APPNAME << ": " << msg[i]->msg << endl;
-+                 break;
-+         }
-+     }
-+     return PAM_SUCCESS;
-+ }
-+ #endif
-  
-  extern App* LoginApp;
-  
+*** 41,48 ****
+      Panel* panel = *static_cast<Panel**>(appdata_ptr);
+      int result = PAM_SUCCESS;
+      for (int i=0; i<num_msg; i++){
+!         resp[i]->resp=0;
+!         resp[i]->resp_retcode=0;
+          switch(msg[i]->msg_style){
+              case PAM_PROMPT_ECHO_ON:
+                  // We assume PAM is asking for the username
+--- 41,48 ----
+      Panel* panel = *static_cast<Panel**>(appdata_ptr);
+      int result = PAM_SUCCESS;
+      for (int i=0; i<num_msg; i++){
+!         (*resp)[i].resp=0;
+!         (*resp)[i].resp_retcode=0;
+          switch(msg[i]->msg_style){
+              case PAM_PROMPT_ECHO_ON:
+                  // We assume PAM is asking for the username
 ***************
-*** 133,138 ****
---- 171,209 ----
-          }
-      }
-  
-+ #ifdef USE_PAM
-+     int last_result;
-+     struct pam_conv pam_conversation = {
-+         conv,
-+         NULL
-+     };
-+ 
-+     // Start the PAM session
-+     if ((last_result=pam_start(PAM_service, NULL, &pam_conversation, &pamh))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+         exit(ERR_EXIT);
-+     }
-+ 
-+     // Setup some PAM items
-+     if ((last_result=pam_set_item(pamh, PAM_TTY, DisplayName))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+ 	pam_end(pamh, last_result);
-+         exit(ERR_EXIT);
-+     }
-+     char* pam_ruser = "root\0"; // <---- We already checked for this in the constructor
-+     if ((last_result=pam_set_item(pamh, PAM_RUSER, pam_ruser))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+ 	pam_end(pamh, last_result);
-+         exit(ERR_EXIT);
-+     }
-+     char* pam_rhost = "localhost\0"; // <---- This might not entirely correct
-+     if ((last_result=pam_set_item(pamh, PAM_RHOST, pam_rhost))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+ 	pam_end(pamh, last_result);
-+         exit(ERR_EXIT);
-+     }
-+ #endif
-+ 
-      bool loaded = false;
-      while (!loaded) {
-          themedir =  themebase + themeName;
+*** 51,63 ****
+                      case Panel::Suspend:
+                      case Panel::Halt:
+                      case Panel::Reboot:
+!                         resp[i]->resp=strdup("root");
+                          break;
+  
+                      case Panel::Console:
+                      case Panel::Exit:
+                      case Panel::Login:
+!                         resp[i]->resp=strdup(panel->GetName().c_str());
+                          break;
+                  }
+                  break;
+--- 51,63 ----
+                      case Panel::Suspend:
+                      case Panel::Halt:
+                      case Panel::Reboot:
+!                         (*resp)[i].resp=strdup("root");
+                          break;
+  
+                      case Panel::Console:
+                      case Panel::Exit:
+                      case Panel::Login:
+!                         (*resp)[i].resp=strdup(panel->GetName().c_str());
+                          break;
+                  }
+                  break;
 ***************
-*** 313,318 ****
---- 384,421 ----
-      struct passwd *pw;
-      pid_t pid;
-  
-+ #ifdef USE_PAM
-+      int last_result;
-+      switch ((last_result=pam_setcred(pamh, PAM_ESTABLISH_CRED | PAM_SILENT))){
-+         case PAM_SUCCESS:
-+             // Credentials was established successfully
-+             break;
-+ 
-+         case PAM_CRED_ERR:
-+         case PAM_CRED_EXPIRED:
-+         case PAM_CRED_UNAVAIL:
-+         case PAM_USER_UNKNOWN:
-+             // Credentials couldn't be established
-+             cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+             return;
-+ 
-+         case PAM_BUF_ERR:
-+         case PAM_SYSTEM_ERR:
-+         default:
-+             // System error -> bail out!
-+             last_result=pam_setcred(pamh, PAM_DELETE_CRED);
-+             pam_end(pamh, last_result);
-+             exit(ERR_EXIT);
-+     }
-+ 
-+     if ((last_result=pam_open_session(pamh, PAM_SILENT))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+     	pam_setcred(pamh, PAM_DELETE_CRED);
-+ 	// TODO: Do we need more serious actions?
-+         return;
-+     }
-+ #endif
-+ 
-      pw = LoginPanel->GetInput()->GetPasswdStruct();
-      if(pw == 0)
-          return;
-***************
-*** 320,325 ****
---- 423,433 ----
-      // Create new process
-      pid = fork();
-      if(pid == 0) {
-+ #ifdef USE_PAM
-+         // Close the child's copy of the PAM-handle
-+         pam_end(pamh, PAM_SUCCESS | PAM_DATA_SILENT);
-+ #endif
-+ 
-          // Login process starts here
-          SwitchUser Su(pw, cfg, DisplayName);
-          string session = LoginPanel->getSession();
+*** 73,79 ****
+  
+                      default:
+                          panel->EventHandler(Panel::Get_Passwd);
+!                         resp[i]->resp=strdup(panel->GetPasswd().c_str());
+                          break;
+                  }
+                  break;
+--- 73,79 ----
+  
+                      default:
+                          panel->EventHandler(Panel::Get_Passwd);
+!                         (*resp)[i].resp=strdup(panel->GetPasswd().c_str());
+                          break;
+                  }
+                  break;
 ***************
-*** 355,361 ****
-          }
+*** 89,97 ****
       }
-  
-!     // Close all clients
-      KillAllClients(False);
-      KillAllClients(True);
-  
---- 463,477 ----
-          }
+      if (result!=PAM_SUCCESS){
+          for (int i=0; i<num_msg; i++){
+!             if (resp[i]->resp==0) continue;
+!             free(resp[i]->resp);
+!             resp[i]->resp=0;
+          };
+          free(*resp);
+          *resp=0;
+--- 89,97 ----
       }
-  
-! #ifdef USE_PAM
-!     if ((last_result=pam_close_session(pamh, PAM_SILENT))!=PAM_SUCCESS){
-!         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-!     	last_result=pam_setcred(pamh, PAM_DELETE_CRED);	
-! 	// TODO: Do we need more serious actions?
-!     }
-! #endif
-! 
-! // Close all clients
-      KillAllClients(False);
-      KillAllClients(True);
-  
-***************
-*** 382,387 ****
---- 498,510 ----
-      // Stop alarm clock
-      alarm(0);
-  
-+ #ifdef USE_PAM
-+     int last_result;
-+     if ((last_result=pam_end(pamh, PAM_SUCCESS))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+     }
-+ #endif
-+ 
-      // Write message
-      LoginPanel->Message((char*)cfg->getOption("reboot_msg").c_str());
-      sleep(3);
-***************
-*** 398,403 ****
---- 521,533 ----
-      // Stop alarm clock
-      alarm(0);
-  
-+ #ifdef USE_PAM
-+     int last_result;
-+     if ((last_result=pam_end(pamh, PAM_SUCCESS))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+     }
-+ #endif
-+ 
-      // Write message
-      LoginPanel->Message((char*)cfg->getOption("shutdown_msg").c_str());
-      sleep(3);
-***************
-*** 433,438 ****
---- 563,575 ----
-  
-  
-  void App::Exit() {
-+ #ifdef USE_PAM
-+     int last_result;
-+     if ((last_result=pam_end(pamh, PAM_SUCCESS))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+     }
-+ #endif
-+ 
-      if (testing) {
-          char* testmsg = "This is a test message :-)";
-          LoginPanel->Message(testmsg);
-***************
-*** 453,458 ****
---- 590,602 ----
-  }
-  
-  void App::RestartServer() {
-+ #ifdef USE_PAM
-+     int last_result;
-+     if ((last_result=pam_end(pamh, PAM_SUCCESS))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+     }
-+ #endif
-+ 
-          StopServer(); 
-          RemoveLock();
-          Run();
-Only in slim-1.2.6/: app.cpp~
-diff -rc slim-1.2.6-orig/input.cpp slim-1.2.6/input.cpp
-*** slim-1.2.6-orig/input.cpp	2006-09-15 23:00:37.000000000 +0200
---- slim-1.2.6/input.cpp	2007-06-05 12:45:58.000000000 +0200
-***************
-*** 12,17 ****
---- 12,25 ----
-  #include "input.h"
-  #include <cstdlib>
-  
-+ #ifdef USE_PAM
-+ #include <security/pam_appl.h>
-+ #include <string>
-+ 
-+ extern pam_handle_t* pamh;
-+ extern string password;
-+ #endif
-+ 
-  Input::Input(Cfg* c) {
-      NameBuffer[0] = '\0';
-      PasswdBuffer[0] = '\0';
-***************
-*** 100,106 ****
---- 108,126 ----
-  
-  
-  struct passwd* Input::GetPasswdStruct() {
-+ #ifdef USE_PAM
-+     int last_result;
-+     char* username=NULL;
-+ 
-+     if ((last_result=pam_get_item(pamh, PAM_USER, (const void**)&username))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+         pam_end(pamh, last_result);
-+         exit(ERR_EXIT);
-+     }
-+     struct passwd* pw = getpwnam(username);
-+ #else
-      struct passwd* pw = getpwnam(NameBuffer);
-+ #endif
-      endpwent();
-      if (pw->pw_shell[0] == '\0') {
-          setusershell();
-***************
-*** 183,188 ****
---- 203,240 ----
-  }
-  
-  int Input::Correct() {
-+ #ifdef USE_PAM
-+     int last_result;
-+ 
-+     // Store the password in global variables accessible
-+     // by the PAM-conversation function
-+     password=PasswdBuffer;
-+ 
-+ 	// Set the username in PAM
-+     if ((last_result=pam_set_item(pamh, PAM_USER, NameBuffer))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+         pam_end(pamh, last_result);
-+         exit(ERR_EXIT);
-+     }    
-+ 
-+     // Authenticate the user
-+     if ((last_result=pam_authenticate(pamh, PAM_DISALLOW_NULL_AUTHTOK))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+         if (last_result==PAM_ABORT){
-+             pam_end(pamh, last_result);
-+             exit(ERR_EXIT);
-+         }
-+ 	return 0;
-+     }
-+ 
-+     // Check the health of the account
-+     if ((last_result=pam_acct_mgmt(pamh, PAM_SILENT))!=PAM_SUCCESS){
-+         cerr << APPNAME << ": " << pam_strerror(pamh, last_result) << endl;
-+ 	return 0;
-+     }
-+ 
-+     return 1;
-+ #else
-      char *unencrypted, *encrypted, *correct;
-      struct passwd *pw;
-  
-***************
-*** 197,203 ****
-      if(sp)
-  	correct = sp->sp_pwdp;
-      else
-! #endif
-  	correct = pw->pw_passwd;
-  
-      if(correct == 0 || correct[0] == '\0')
---- 249,255 ----
-      if(sp)
-  	correct = sp->sp_pwdp;
-      else
-! #endif        /* HAVE_SHADOW */
-  	correct = pw->pw_passwd;
-  
-      if(correct == 0 || correct[0] == '\0')
-***************
-*** 207,212 ****
---- 259,265 ----
-      encrypted = crypt(unencrypted, correct);
-      memset(unencrypted, 0, strlen (unencrypted));
-      return (strcmp(encrypted, correct) == 0);
-+ #endif        /* USE_PAM */
-  }
-  
-  
-diff -rc slim-1.2.6-orig/Makefile slim-1.2.6/Makefile
-*** slim-1.2.6-orig/Makefile	2006-09-15 23:00:37.000000000 +0200
---- slim-1.2.6/Makefile	2007-06-05 12:45:58.000000000 +0200
-***************
-*** 6,13 ****
-  CXX=/usr/bin/g++
-  CC=/usr/bin/gcc
-  CFLAGS=-I. -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/libpng12 -I/usr/include
-! LDFLAGS=-L/usr/X11R6/lib -lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng12 -lz -lm -lcrypt -lXmu -lpng -ljpeg
-! CUSTOM=-DHAVE_SHADOW
-  PREFIX=/usr
-  CFGDIR=/etc
-  MANDIR=/usr/man
---- 6,13 ----
-  CXX=/usr/bin/g++
-  CC=/usr/bin/gcc
-  CFLAGS=-I. -I/usr/X11R6/include -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/libpng12 -I/usr/include
-! LDFLAGS=-L/usr/X11R6/lib -lXft -lX11 -lfreetype -lXrender -lfontconfig -lpng12 -lz -lm -lcrypt -lXmu -lpng -ljpeg -lpam
-! CUSTOM=-DHAVE_SHADOW -DUSE_PAM
-  PREFIX=/usr
-  CFGDIR=/etc
-  MANDIR=/usr/man
+      if (result!=PAM_SUCCESS){
+          for (int i=0; i<num_msg; i++){
+!             if ((*resp)[i].resp==0) continue;
+!             free((*resp)[i].resp);
+!             (*resp)[i].resp=0;
+          };
+          free(*resp);
+          *resp=0;
diff --git a/pkgs/applications/editors/emacs-modes/bbdb/default.nix b/pkgs/applications/editors/emacs-modes/bbdb/default.nix
index 3799d0a0f1bd..51474a197174 100644
--- a/pkgs/applications/editors/emacs-modes/bbdb/default.nix
+++ b/pkgs/applications/editors/emacs-modes/bbdb/default.nix
@@ -14,8 +14,7 @@ stdenv.mkDerivation {
   builder = ./builder.sh;
 
   meta = {
-    description = ''The Insidious Big Brother Database (BBDB), a
-                    contact management utility for Emacs.'';
+    description = "The Insidious Big Brother Database (BBDB), a contact management utility for Emacs";
     homepage = http://bbdb.sourceforge.net/;
     license = "GPL";
   };
diff --git a/pkgs/applications/editors/emacs-modes/cedet/default.nix b/pkgs/applications/editors/emacs-modes/cedet/default.nix
new file mode 100644
index 000000000000..6a91ac496517
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/cedet/default.nix
@@ -0,0 +1,48 @@
+{ fetchurl, stdenv, emacs }:
+
+stdenv.mkDerivation rec {
+  name = "cedet-1.0pre6";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/cedet/${name}.tar.gz";
+    sha256 = "0pvd54rjlba12cxgqibm8v4i8x43r5c239z891lgcbafjvkzpdxb";
+  };
+
+  buildInputs = [ emacs ];
+
+  doCheck = true;
+  checkPhase = "make utest";
+
+  installPhase = ''
+    ensureDir "$out/share/emacs/site-lisp"
+    cp -v */*.el */*/*.el */*.elc */*/*.elc "$out/share/emacs/site-lisp"
+    chmod a-x "$out/share/emacs/site-lisp/"*
+
+    ensureDir "$out/share/info"
+    cp -v */*.info* */*/*.info* "$out/share/info"
+  '';
+
+  meta = {
+    description = "CEDET, a Collection of Emacs Development Environment Tools";
+
+    longDescription = ''
+      CEDET is a collection of tools written with the end goal of
+      creating an advanced development environment in Emacs.
+
+      Emacs already is a great environment for writing software, but
+      there are additional areas that need improvement.  Many new
+      ideas for integrated environments have been developed in newer
+      products, such as JBuilder, Eclipse, or KDevelop.  CEDET is a
+      project which brings together several different tools needed to
+      implement advanced features.
+
+      CEDET includes EIEIO (Enhanced Implementation of Emacs
+      Interpreted Objects), Semantic, SRecode, Speedbar, EDE (Emacs
+      Development Environment), and COGRE (COnnected GRaph Editor).
+    '';
+
+    license = "GPLv2+";
+
+    homepage = http://cedet.sourceforge.net/;
+  };
+}
diff --git a/pkgs/applications/editors/emacs-modes/eieio/default.nix b/pkgs/applications/editors/emacs-modes/eieio/default.nix
index bbe4c6085acb..436b71022fc8 100644
--- a/pkgs/applications/editors/emacs-modes/eieio/default.nix
+++ b/pkgs/applications/editors/emacs-modes/eieio/default.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
     description = "EIEIO: Enhanced Implementation of Emacs Interpreted Objects";
 
     longDescription = ''
+      This package is now part of CEDET, please upgrade.
+
       EIEIO is a package which implements a CLOS subset for Emacs.  It
       includes examples which can draw simple tree graphs, and bar
       charts.
diff --git a/pkgs/applications/editors/emacs-modes/quack/default.nix b/pkgs/applications/editors/emacs-modes/quack/default.nix
index 3dea3f41fd6b..943359086e7f 100644
--- a/pkgs/applications/editors/emacs-modes/quack/default.nix
+++ b/pkgs/applications/editors/emacs-modes/quack/default.nix
@@ -14,8 +14,7 @@ stdenv.mkDerivation {
   builder = ./builder.sh;
 
   meta = {
-    description = ''Quack: Enhanced Emacs Support for Editing and
-                    Running Scheme Code'';
+    description = "Enhanced Emacs support for editing and running Scheme code";
     homepage = http://www.neilvandyke.org/quack/;
     license = "GPLv2+";
   };
diff --git a/pkgs/applications/editors/emacs-modes/semantic/default.nix b/pkgs/applications/editors/emacs-modes/semantic/default.nix
index dfb1902c1c24..0ff6392472bb 100644
--- a/pkgs/applications/editors/emacs-modes/semantic/default.nix
+++ b/pkgs/applications/editors/emacs-modes/semantic/default.nix
@@ -30,6 +30,8 @@ stdenv.mkDerivation rec {
     description = "Semantic, infrastructure for parser based text analysis in Emacs";
 
     longDescription = ''
+      This package is now part of CEDET, please upgrade.
+
       Semantic is an infrastructure for parser based text analysis in
       Emacs.  It is a lexer, parser-generator, and parser.  It is
       written in Emacs Lisp and is customized to the way Emacs thinks
diff --git a/pkgs/applications/editors/emacs-unicode/default.nix b/pkgs/applications/editors/emacs-unicode/default.nix
index 169fe6e0b304..84a9cae816ea 100644
--- a/pkgs/applications/editors/emacs-unicode/default.nix
+++ b/pkgs/applications/editors/emacs-unicode/default.nix
@@ -1,38 +1,43 @@
 { xawSupport ? true
 , xpmSupport ? true
+, dbusSupport ? true
 , xaw3dSupport ? false
 , gtkGUI ? false
 , xftSupport ? false
-, stdenv, fetchurl, ncurses, x11, libXaw ? null, libXpm ? null, Xaw3d ? null
-, pkgconfig ? null, gtk ? null, libXft ? null
+, stdenv, fetchcvs, ncurses, x11, libXaw ? null, libXpm ? null, Xaw3d ? null
+, pkgconfig ? null, gtk ? null, libXft ? null, dbus ? null
 , libpng, libjpeg, libungif, libtiff, texinfo
+, autoconf, automake
 }:
 
 assert xawSupport -> libXaw != null;
 assert xpmSupport -> libXpm != null;
+assert dbusSupport -> dbus != null;
 assert xaw3dSupport -> Xaw3d != null;
 assert gtkGUI -> pkgconfig != null && gtk != null;
 assert xftSupport -> libXft != null && libpng != null; # libpng = probably a bug
 
-let date = "20080228"; in
+let date = "2009-02-16"; in
 stdenv.mkDerivation {
   name = "emacs-snapshot-23-${date}";
   
   builder = ./builder.sh;
   
-  src = fetchurl {
-    url = "http://ppa.launchpad.net/avassalotti/ubuntu/pool/main/e/emacs-snapshot/emacs-snapshot_${date}.orig.tar.gz";
-    sha256 = "1cix1qjrynidvdyww3g8fm1wyggc82qjxbfbv3rx630szm1v6bm7";
+  src = fetchcvs {
+    inherit date;
+    cvsRoot = ":pserver:anonymous@cvs.savannah.gnu.org:/sources/emacs";
+    module = "emacs";
+    sha256 = "6ec63da94a199c5f95bf4a9aa578cf14b3d85800fd37b3562d9a446b144b0d47";
   };
 
-#  patches = [
-#    ./crt.patch
-#  ];
+  preConfigure = "autoreconf -vfi";
   
   buildInputs = [
+    autoconf automake
     ncurses x11 texinfo
     (if xawSupport then libXaw else null)
     (if xpmSupport then libXpm else null)
+    (if dbusSupport then dbus else null)
     (if xaw3dSupport then Xaw3d else null)
     libpng libjpeg libungif libtiff # maybe not strictly required?
   ]
@@ -44,7 +49,7 @@ stdenv.mkDerivation {
   ";
 
   meta = {
-    description = "Emacs with Unicode, GTK and Xft support (23.x alpha)";
+    description = "GNU Emacs with Unicode, GTK and Xft support (23.x alpha)";
     homepage = http://www.emacswiki.org/cgi-bin/wiki/XftGnuEmacs;
     license = "GPLv3+";
   };
diff --git a/pkgs/applications/editors/vim/configurable.nix b/pkgs/applications/editors/vim/configurable.nix
index b958eb6b8129..162b0c92ebe9 100644
--- a/pkgs/applications/editors/vim/configurable.nix
+++ b/pkgs/applications/editors/vim/configurable.nix
@@ -2,77 +2,79 @@
 # but I have gvim with python support now :) - Marc
 args: with args;
 let inherit (args.composableDerivation) composableDerivation edf; in
-composableDerivation {
-  initial = {
+composableDerivation {} {
 
-      name = "vim_configurable-7.1";
+    name = "vim_configurable-7.2";
 
-      src = args.fetchurl {
-        url = ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2;
-        sha256 = "11hxkb6r2550c4n13nwr0d8afvh30qjyr5c2hw16zgay43rb0kci";
-      };
-
-      configureFlags = ["--enable-gui=auto" "--with-features=${args.features}"];
+    src = args.fetchurl {
+      url = ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2;
+      sha256 = "11hxkb6r2550c4n13nwr0d8afvh30qjyr5c2hw16zgay43rb0kci";
+    };
 
-      buildInputs = [ncurses pkgconfig]
-        ++ [ gtk libX11 libXext libSM libXpm libXt libXaw libXau libXmu ];
+    configureFlags = ["--enable-gui=auto" "--with-features=${args.features}"];
 
-      # 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"; feat = "perlinterp"; enable = { buildInputs = [perl]; };} #Include Perl interpreter.
-        // edf { name = "python"; feat = "pythoninterp"; enable = { buildInputs = [python]; }; } #Include Python interpreter.
-        // edf { name = "tcl"; enable = { buildInputs = [tcl]; }; } #Include Tcl interpreter.
-        // edf { name = "ruby"; feat = "rubyinterp"; enable = { buildInputs = [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()).
-        ;
+    buildInputs = [ncurses pkgconfig]
+      ++ [ gtk libX11 libXext libSM libXpm libXt libXaw libXau libXmu ];
 
-    cfg = {
-      pythonSupport = true;
-    };
+    # most interpreters aren't tested yet.. (see python for example how to do it)
+    flags = {
+        ftNix = {
+          patches = [ ./ft-nix-support.patch ];
+        };
+      }
+      // 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"; feat = "perlinterp"; enable = { buildInputs = [perl]; };} #Include Perl interpreter.
+      // edf { name = "python"; feat = "pythoninterp"; enable = { buildInputs = [python]; }; } #Include Python interpreter.
+      // edf { name = "tcl"; enable = { buildInputs = [tcl]; }; } #Include Tcl interpreter.
+      // edf { name = "ruby"; feat = "rubyinterp"; enable = { buildInputs = [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()).
+      ;
 
-    #--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
-      */
+  cfg = {
+    pythonSupport = true;
+    ftNixSupport = true; # add .nix filetype detection and minimal syntax highlighting support
+  };
 
-    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;
+  #--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
+    */
 
-    meta = {
-      description = "The most popular clone of the VI editor";
-      homepage = "www.vim.org";
-    };
+  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";
   };
 
 }
diff --git a/pkgs/applications/editors/vim/ft-nix-support.patch b/pkgs/applications/editors/vim/ft-nix-support.patch
new file mode 100644
index 000000000000..4b5a742dac1c
--- /dev/null
+++ b/pkgs/applications/editors/vim/ft-nix-support.patch
@@ -0,0 +1,66 @@
+diff --git a/runtime/filetype.vim b/runtime/filetype.vim
+index a8e6261..2b008fc 100644
+--- a/runtime/filetype.vim
++++ b/runtime/filetype.vim
+@@ -2258,6 +2258,9 @@ au BufNewFile,BufRead *.zsql			call s:SQL()
+ " Z80 assembler asz80
+ au BufNewFile,BufRead *.z8a			setf z8a
+ 
++" NIX
++au BufNewFile,BufRead *.nix		setf nix
++
+ augroup END
+ 
+ 
+@@ -2440,3 +2443,5 @@ endfunc
+ " Restore 'cpoptions'
+ let &cpo = s:cpo_save
+ unlet s:cpo_save
++
++
+diff --git a/runtime/syntax/nix.vim b/runtime/syntax/nix.vim
+new file mode 100644
+index 0000000..a2f9918
+--- /dev/null
++++ b/runtime/syntax/nix.vim
+@@ -0,0 +1,40 @@
++" Vim syntax file
++" Language:	nix
++" Maintainer:	Marc Weber <marco-oweber@gmx.de>
++"               Modify and commit if you feel that way
++" Last Change:	2007 Dec
++"
++" this syntax file can be still be enhanced very much..
++" Don't ask, do it :-)
++
++" Quit when a (custom) syntax file was already loaded
++if exists("b:current_syntax")
++  finish
++endif
++
++syn keyword	nixKeyword	let throw inherit import true false null with
++syn keyword	nixConditional	if else then
++syn keyword     nixBrace        ( ) { } =
++syn keyword     nixBuiltin         __currentSystem __currentTime __isFunction __getEnv __trace __toPath __pathExists 
++  \ __readFile __toXML __toFile __filterSource __attrNames __getAttr __hasAttr __isAttrs __listToAttrs __isList 
++  \ __head __tail __add __sub __lessThan __substring __stringLength
++
++syn match nixAttr "\w\+\ze\s*="
++syn match nixFuncArg "\zs\w\+\ze\s*:"
++syn region nixStringParam start=+\${+ end=+}+
++syn region nixMultiLineComment start=+/\*+ skip=+\\"+ end=+\*/+
++syn match  nixEndOfLineComment "#.*$"
++syn region nixStringIndented start=+''+ skip=+'''\|''${\|"+ end=+''+ contains=nixStringParam
++syn region nixString         start=+"+ skip=+\\"+ end=+"+ contains=nixStringParam
++
++hi def link nixKeyword       Keyword
++hi def link nixConditional   Conditional
++hi def link nixBrace         Special
++hi def link nixString        String
++hi def link nixStringIndented String
++hi def link nixBuiltin       Special
++hi def link nixStringParam   Macro
++hi def link nixMultiLineComment Comment
++hi def link nixEndOfLineComment Comment
++hi def link nixAttr        Identifier
++hi def link nixFuncArg     Identifier
diff --git a/pkgs/applications/editors/zile/default.nix b/pkgs/applications/editors/zile/default.nix
new file mode 100644
index 000000000000..7ac4e1f61850
--- /dev/null
+++ b/pkgs/applications/editors/zile/default.nix
@@ -0,0 +1,43 @@
+{ fetchurl, stdenv, ncurses, help2man }:
+
+stdenv.mkDerivation rec {
+  name = "zile-2.3.4";
+
+  src = fetchurl {
+    url = "mirror://gnu/zile/${name}.tar.gz";
+    sha256 = "1m20j5plpbx7rbk9rw3jsirip5gja5n8amqvg4mqs3pb28isx1fx";
+  };
+
+  buildInputs = [ ncurses help2man ];
+
+  # Tests can't be run because most of them rely on the ability to
+  # fiddle with the terminal.
+  doCheck = false;
+
+  meta = {
+    description = "GNU Zile, a lightweight Emacs clone";
+
+    longDescription = ''
+      GNU Zile, which is a lightweight Emacs clone.  Zile is short
+      for Zile Is Lossy Emacs.  Zile has been written to be as
+      similar as possible to Emacs; every Emacs user should feel at
+      home.
+
+      Zile has all of Emacs's basic editing features: it is 8-bit
+      clean (though it currently lacks Unicode support), and the
+      number of editing buffers and windows is only limited by
+      available memory and screen space respectively.  Registers,
+      minibuffer completion and auto fill are available.  Function
+      and variable names are identical with Emacs's (except those
+      containing the word "emacs", which instead contain the word
+      "zile"!).
+
+      However, all of this is packed into a program which typically
+      compiles to about 130Kb.
+    '';
+
+    homepage = http://www.gnu.org/software/zile/;
+
+    license = "GPLv3+";
+  };
+}
diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix
index 985701967b0e..9cf07183ff28 100644
--- a/pkgs/applications/graphics/gimp/default.nix
+++ b/pkgs/applications/graphics/gimp/default.nix
@@ -4,11 +4,11 @@
 }:
 
 stdenv.mkDerivation {
-  name = "gimp-2.6.4";
+  name = "gimp-2.6.5";
   
   src = fetchurl {
-    url = ftp://ftp.gtk.org/pub/gimp/v2.6/gimp-2.6.4.tar.bz2;
-    sha256 = "1qlpszdaskh575xjibkxvvqxmgp8j7v1i1z2dnzz6gazni2pmll6";
+    url = ftp://ftp.gtk.org/pub/gimp/v2.6/gimp-2.6.5.tar.bz2;
+    sha256 = "08g5rc383ijcdfqr9ybrn6qazxqqfq0pndknsgh25z19bhghh2b2";
   };
   
   buildInputs = [
diff --git a/pkgs/applications/graphics/gocr/0.44.nix b/pkgs/applications/graphics/gocr/0.44.nix
index 7273c5d98c31..4d3d33f58f54 100644
--- a/pkgs/applications/graphics/gocr/0.44.nix
+++ b/pkgs/applications/graphics/gocr/0.44.nix
@@ -15,9 +15,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		GPL Optical Character Recognition
-";
+		description = "GPL Optical Character Recognition";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/graphics/inkscape/default.nix b/pkgs/applications/graphics/inkscape/default.nix
index 33defc0bea42..f2379220a65b 100644
--- a/pkgs/applications/graphics/inkscape/default.nix
+++ b/pkgs/applications/graphics/inkscape/default.nix
@@ -41,8 +41,9 @@ stdenv.mkDerivation rec {
   meta = {
     license = "GPL";
     homepage = http://www.inkscape.org;
-    description = ''Inkscape is a feature-rich vector graphics editor
-                    that edits files in the W3C SVG (Scalable Vector
-		    Graphics) file format.'';
+    longDescription = ''
+      Inkscape is a feature-rich vector graphics editor that edits
+      files in the W3C SVG (Scalable Vector Graphics) file format.
+    '';
   };
 }
diff --git a/pkgs/applications/graphics/xscreensaver/default.nix b/pkgs/applications/graphics/xscreensaver/default.nix
index 5c779e5e1b66..bcef30ddc5aa 100644
--- a/pkgs/applications/graphics/xscreensaver/default.nix
+++ b/pkgs/applications/graphics/xscreensaver/default.nix
@@ -29,13 +29,11 @@ let
 	") [minInit doUnpack];
 in
 stdenv.mkDerivation rec {
-	name = "xscreensaver-"+version;
+	name = "xscreensaver-5.07";
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	The X screensaver daemon. Run xscreensaver-demo to configure.
-";
+		description = "A set of screensavers";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/misc/audio/sox/default.nix b/pkgs/applications/misc/audio/sox/default.nix
index 1655457b4049..9e72bedfb5a2 100644
--- a/pkgs/applications/misc/audio/sox/default.nix
+++ b/pkgs/applications/misc/audio/sox/default.nix
@@ -1,61 +1,58 @@
 args: with args;
 let inherit (args.composableDerivation) composableDerivation edf; in
-composableDerivation {
-
-  initial = {
-
-      name = "sox-14.0.0";
-
-      src = args.fetchurl {
-        url = mirror://sourceforge/sox/sox-14.0.0.tar.gz;
-        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;
+composableDerivation {} {
+
+    name = "sox-14.0.0";
+
+    src = args.fetchurl {
+      url = mirror://sourceforge/sox/sox-14.0.0.tar.gz;
+      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" */ ];
 
+  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;
-      # 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";
+                } ];
   };
 }
diff --git a/pkgs/applications/misc/djvulibre/default.nix b/pkgs/applications/misc/djvulibre/default.nix
index 81aa12e59f65..2a8d78b0f0ed 100644
--- a/pkgs/applications/misc/djvulibre/default.nix
+++ b/pkgs/applications/misc/djvulibre/default.nix
@@ -1,4 +1,5 @@
 args: with args;
+
 stdenv.mkDerivation {
   name = "djvulibre-3.5.19";
 
@@ -7,15 +8,10 @@ stdenv.mkDerivation {
     sha256 = "0y6d9ka42llm7h64fc73s4wqcbxg31kallyfaarhkqsxyiaa3zsp";
   };
 
-  buildInputs = [qt libX11 libjpeg libtiff libpng ghostscript zlib libungif
-	x11 mesa];
+  buildInputs = [qt libX11 libjpeg libtiff libpng ghostscript zlib libungif x11 mesa];
 
   meta = {
-    description = "
-	DjVu libre - a library and a viewer for djvu format - compression for
-	scanned images.
-";
+    description = "A library and viewer for the DJVU file format for scanned images";
     homepage = http://djvu.sourceforge.net;
   };
 }
-
diff --git a/pkgs/applications/misc/dmenu/default.nix b/pkgs/applications/misc/dmenu/default.nix
index 1505a22a6c97..2372c43de601 100644
--- a/pkgs/applications/misc/dmenu/default.nix
+++ b/pkgs/applications/misc/dmenu/default.nix
@@ -1,10 +1,10 @@
 args: with args;
 stdenv.mkDerivation {
-  name = "dmenu-3.8";
+  name = "dmenu-3.9";
 
   src = fetchurl {
-    url = http://code.suckless.org/dl/tools/dmenu-3.8.tar.gz;
-    sha256 = "6d111a0e4d970df827f6e3c8ff60f5c96fdac4805f8100d508087859dc4f158b";
+    url = http://code.suckless.org/dl/tools/dmenu-3.9.tar.gz;
+    sha256 = "2370111e02c6a3863ea04376795fa72f9e41cdd2650b12f90e6a0c7d096e4b22";
   };
 
   buildInputs = [ libX11 libXinerama ];
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
 
   meta = { 
       description = "a generic, highly customizable, and efficient menu for the X Window System";
-      homepage = http://www.suckless.org/programs/dmenu.html;
+      homepage = http://tools.suckless.org/dmenu;
       license = "MIT";
   };
 }
diff --git a/pkgs/applications/misc/qgis/0.11.0.nix b/pkgs/applications/misc/qgis/0.11.0.nix
index 127675b358d5..ed8bb6063c31 100644
--- a/pkgs/applications/misc/qgis/0.11.0.nix
+++ b/pkgs/applications/misc/qgis/0.11.0.nix
@@ -3,43 +3,41 @@ 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";
+composableDerivation.composableDerivation {} {
 
+  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/networking/browsers/firefox-3/default.nix b/pkgs/applications/networking/browsers/firefox-3/default.nix
index 104e0000811d..95bbceaaee72 100644
--- a/pkgs/applications/networking/browsers/firefox-3/default.nix
+++ b/pkgs/applications/networking/browsers/firefox-3/default.nix
@@ -10,13 +10,15 @@
     
 }:
 
-stdenv.mkDerivation {
-  name = "firefox-3.0.6";
+stdenv.mkDerivation rec {
+  name = "firefox-${version}";
+  
+  version = "3.0.7";
 
   src = fetchurl {
     # Don't forget to update xulrunner.nix as well!
-    url = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.6/source/firefox-3.0.6-source.tar.bz2;
-    sha1 = "e2845c07b507308664f6f39086a050b2773382fb";
+    url = "http://releases.mozilla.org/pub/mozilla.org/firefox/releases/${version}/source/firefox-${version}-source.tar.bz2";
+    sha1 = "03c078d9c2d047d7cdc25f7823c6e647cb8d8f8b";
   };
 
   buildInputs = [
diff --git a/pkgs/applications/networking/browsers/firefox-3/xulrunner.nix b/pkgs/applications/networking/browsers/firefox-3/xulrunner.nix
index 8deb54829e10..2e9c4a4a80e3 100644
--- a/pkgs/applications/networking/browsers/firefox-3/xulrunner.nix
+++ b/pkgs/applications/networking/browsers/firefox-3/xulrunner.nix
@@ -11,7 +11,7 @@
 
 let
 
-  version = "1.9.0.6"; # this attribute is used by other packages
+  version = "1.9.0.7"; # this attribute is used by other packages
 
 in  
 
@@ -19,8 +19,8 @@ stdenv.mkDerivation {
   name = "xulrunner-${version}";
 
   src = fetchurl {
-    url = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.6/source/firefox-3.0.6-source.tar.bz2;
-    sha1 = "e2845c07b507308664f6f39086a050b2773382fb";
+    url = http://releases.mozilla.org/pub/mozilla.org/firefox/releases/3.0.7/source/firefox-3.0.7-source.tar.bz2;
+    sha1 = "03c078d9c2d047d7cdc25f7823c6e647cb8d8f8b";
   };
 
   buildInputs = [
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/builder.sh b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/builder.sh
index 551b0e1c03fa..2574ecb73eec 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/builder.sh
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/builder.sh
@@ -3,6 +3,16 @@ source $stdenv/setup
 dontStrip=1
 dontPatchELF=1
 
+unpackPhase() {
+    tar xvzf $src;
+    for a in *; do
+	if [ -d $a ]; then
+		cd $a
+		break
+	fi
+    done
+}
+
 installPhase() {
     ensureDir $out/lib/mozilla/plugins
     cp -p libflashplayer.so $out/lib/mozilla/plugins
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/default.nix
index 043273a635c1..c5c8414f8532 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer-10/default.nix
@@ -1,15 +1,20 @@
 {stdenv, fetchurl, zlib, alsaLib, curl}:
 
-assert stdenv.system == "i686-linux";
-
 stdenv.mkDerivation {
-  name = "flashplayer-10.0.12.36";
+  name = if (stdenv.system == "x86_64-linux") then
+      "flashplayer-10.0.22.87"
+    else
+      "flashplayer-10.0.22";
 
   builder = ./builder.sh;
   
-  src = fetchurl {
+  src = if (stdenv.system == "x86_64-linux") then fetchurl {
+    url = http://download.macromedia.com/pub/labs/flashplayer10/libflashplayer-10.0.22.87.linux-x86_64.so.tar.gz;
+    sha256 = "eac1d05aa96036819fe8f14f293a2ccc9601e1e32e08ec33e6ed9ed698e76145";
+  }
+  else fetchurl {
     url = http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_10_linux.tar.gz;
-    sha256 = "cd3e8fbb05da4a5303f958cb627bc7f3845dd86576a96ab157effc4f0ae65e5d";
+    sha256 = "cd29f166c87fecc943e88fe951bb61c56728fab12b4bf343badafa73ea95394e";
   };
 
   inherit zlib alsaLib;
diff --git a/pkgs/applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/default.nix b/pkgs/applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/default.nix
index 930e2d108be2..ba3f041738a6 100644
--- a/pkgs/applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/default.nix
+++ b/pkgs/applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/default.nix
@@ -1,43 +1,46 @@
-{stdenv, fetchurl, pidgin, imagemagick, ghostscript,
-	pkgconfig, glib, gtk, texLive}:
+{ stdenv, fetchurl, pidgin, imagemagick, ghostscript
+, pkgconfig, glib, gtk, texLive
+}:
+        
 stdenv.mkDerivation {
   name = "pidgin-latex";
 
-  src = 
-	fetchurl {
-		url = http://tapas.affenbande.org/pidgin-latex/pidgin-latex-0.9.tgz;
-		sha256 = "1yqd3qgxd3n8hm60qg7yv7j1crr6f3d4yrdpgwdpw2pyf92p8nxp";
-	};
+  src = fetchurl {
+    url = http://tapas.affenbande.org/pidgin-latex/pidgin-latex-0.9.tgz;
+    sha256 = "1yqd3qgxd3n8hm60qg7yv7j1crr6f3d4yrdpgwdpw2pyf92p8nxp";
+  };
 
-  preBuild = "
-  	sed -e '/^PREFIX/d' -i Makefile ; 
-	sed -e 's@/usr/bin/latex@${texLive}/bin/pdflatex@g' -i pidgin-latex.h
-	sed -e 's@/usr/bin/convert@${imagemagick}/bin/convert@g' -i pidgin-latex.h
-	sed -e 's@.*convert_path.*@const gchar *convert = CONVERT_PATH;@'
-	sed -e 's@.*latex_path.*@const gchar *convert = LATEX_PATH;@'
-	sed -e 's/%s.dvi/%s.pdf/' -i pidgin-latex.c
-	sed -e 's/latex_system\(.*\)FALSE/latex_system\1TRUE/' -i pidgin-latex.c
-  ";
+  preBuild = ''
+    sed -e '/^PREFIX/d' -i Makefile ; 
+    sed -e 's@/usr/bin/latex@${texLive}/bin/pdflatex@g' -i pidgin-latex.h
+    sed -e 's@/usr/bin/convert@${imagemagick}/bin/convert@g' -i pidgin-latex.h
+    sed -e 's@.*convert_path.*@const gchar *convert = CONVERT_PATH;@'
+    sed -e 's@.*latex_path.*@const gchar *convert = LATEX_PATH;@'
+    sed -e 's/%s.dvi/%s.pdf/' -i pidgin-latex.c
+    sed -e 's/latex_system\(.*\)FALSE/latex_system\1TRUE/' -i pidgin-latex.c
+  '';
 
-  makeFlags="PREFIX=\$(out)";
+  makeFlags = "PREFIX=\$(out)";
 
-  preInstall="mkdir -p \${out}/lib/pidgin \${out}/bin";
+  preInstall = "mkdir -p $out/lib/pidgin $out/bin";
   
-  postInstall = "mkdir -p \${out}/share/pidgin-latex; 
-	ln -s \${out}/lib/pidgin/pidgin-latex.so \${out}/share/pidgin-latex/";
+  postInstall = ''
+    mkdir -p $out/share/pidgin-latex
+    ln -s $out/lib/pidgin/pidgin-latex.so $out/share/pidgin-latex/
+  '';
 
   buildInputs = [pidgin imagemagick ghostscript pkgconfig glib gtk texLive];
 
   meta = {
-    description = "
-	Pidgin-LaTeX is a pidgin plugin that cuts everything inside \$\$ .. \$\$
-	and feeds to LaTeX. A bit of conversion (automated, of course) - and you
-	see every formula that occurs in conversation in pretty graphical form.
-	There are some glitches - when a formula fails to compile, you can see 
-	just previous formula..
-	Enable it for user by linking to ~/.purple/plugins - from 
-	sw/share/pidgin-latex , not from store of course.
-";
-		homepage = http://tapas.affenbande.org/wordpress/?page_id=70;
+    longDescription = ''
+      Pidgin-LaTeX is a pidgin plugin that cuts everything inside \$\$
+      .. \$\$ and feeds to LaTeX. A bit of conversion (automated, of
+      course) - and you see every formula that occurs in conversation
+      in pretty graphical form.  There are some glitches - when a
+      formula fails to compile, you can see just previous formula..
+      Enable it for user by linking to ~/.purple/plugins - from
+      sw/share/pidgin-latex , not from store of course.
+    '';
+    homepage = http://tapas.affenbande.org/wordpress/?page_id=70;
   };
 }
diff --git a/pkgs/applications/networking/instant-messengers/pidgin/default.nix b/pkgs/applications/networking/instant-messengers/pidgin/default.nix
index 93c3a46b6d1a..146eb7f13b03 100644
--- a/pkgs/applications/networking/instant-messengers/pidgin/default.nix
+++ b/pkgs/applications/networking/instant-messengers/pidgin/default.nix
@@ -20,10 +20,10 @@
 } :
 
 stdenv.mkDerivation {
-  name = "pidgin-2.5.4";
+  name = "pidgin-2.5.5";
   src = fetchurl {
-    url = mirror://sourceforge/pidgin/pidgin-2.5.4.tar.bz2;
-    sha256 = "0qqvv9x5p2yxmw57sj3hvc10vxpd9mqv61w1pk97qcwbggwvxgn6";
+    url = mirror://sourceforge/pidgin/pidgin-2.5.5.tar.bz2;
+    sha256 = "1s13fzxa62mrxah6khsnpywmw1fknghph1krgwfvcs18kjwi6nnb";
   };
 
   inherit nss ncurses;
diff --git a/pkgs/applications/networking/irc/chatzilla/default.nix b/pkgs/applications/networking/irc/chatzilla/default.nix
index 0225436d468e..c54f7338ebb6 100644
--- a/pkgs/applications/networking/irc/chatzilla/default.nix
+++ b/pkgs/applications/networking/irc/chatzilla/default.nix
@@ -1,12 +1,12 @@
 {stdenv, fetchurl, unzip}:
 
 stdenv.mkDerivation {
-  name = "chatzilla-0.9.83";
+  name = "chatzilla-0.9.84";
   
   src = fetchurl {
     # Obtained from http://chatzilla.rdmsoft.com/xulrunner/.
-    url = http://chatzilla.rdmsoft.com/xulrunner/download/chatzilla-0.9.83-xr.zip;
-    sha256 = "0dzk0k9gmzy7sqbiszakd69pjr4h6pfdsb3s6zbx4gc46z4n3shx";
+    url = http://chatzilla.rdmsoft.com/xulrunner/download/chatzilla-0.9.84-xr.zip;
+    sha256 = "0v1xakdgjjwwh0azxbh7y9yi99gcn0d37sfxrdzw78lbag3fh0k8";
   };
 
   buildInputs = [unzip];
diff --git a/pkgs/applications/networking/mailreaders/thunderbird-3.x/default.nix b/pkgs/applications/networking/mailreaders/thunderbird-3.x/default.nix
new file mode 100644
index 000000000000..5381c65f5160
--- /dev/null
+++ b/pkgs/applications/networking/mailreaders/thunderbird-3.x/default.nix
@@ -0,0 +1,105 @@
+{ stdenv, fetchurl, pkgconfig, gtk, pango, perl, python, zip, libIDL
+, libjpeg, zlib, cairo, dbus, dbus_glib, bzip2
+, freetype, fontconfig, xulrunner
+, autoconf , libpng , alsaLib, sqlite, patchelf
+
+, # If you want the resulting program to call itself "Thunderbird"
+  # instead of "Mail", enable this option.  However, those
+  # binaries may not be distributed without permission from the
+  # Mozilla Foundation, see
+  # http://www.mozilla.org/foundation/trademarks/.
+  enableOfficialBranding ? false
+    
+}:
+
+stdenv.mkDerivation {
+  name = "thunderbird-3.0beta2";
+
+  src = fetchurl {
+    url = "ftp://ftp.mozilla.org/pub/thunderbird/releases/3.0b2/source/thunderbird-3.0b2-source.tar.bz2";
+    sha256 = "17mlp0x6sf1v9w8vraln7mr566gvk84rxvxiwzhbdj2p0475zjqr";
+  };
+
+  buildInputs = [
+    pkgconfig gtk perl zip libIDL libjpeg zlib cairo bzip2
+    python dbus dbus_glib pango freetype fontconfig autoconf
+    libpng alsaLib sqlite patchelf
+  ];
+
+  propagatedBuildInputs = [xulrunner];
+
+  preUnpack = "mkdir thunderbird; cd thunderbird;";
+  setSourceRoot = "export sourceRoot=.;";
+  preConfigure = ''
+    for i in $(find . -name configure.in); do echo $i; (cd $(dirname $i); autoconf || true; ); done;
+    XUL_SDK=$(echo ${xulrunner}/lib/xulrunner-devel-*/)
+    export NIX_CFLAGS_COMPILE="''${NIX_CFLAGS_COMPILE} -I$XUL_SDK/include";
+    export NIX_CFLAGS_COMPILE="''${NIX_CFLAGS_COMPILE} -I$(echo ${xulrunner}/include/xulrunner-*/stable)";
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE";
+    export NIX_LDFLAGS="''${NIX_LDFLAGS} -L$XUL_SDK/lib -L$XUL_SDK/sdk/lib";
+    export NIX_LDFLAGS="$NIX_LDFLAGS -L${xulrunner}/lib/xulrunner-${xulrunner.version}";
+    export NIX_LDFLAGS="$NIX_LDFLAGS -lxpcomglue -lxpcomglue_s -lxul -lnss -lmozjs -lsqlite3";
+    echo NIX_CFLAGS_COMPILE: $NIX_CFLAGS_COMPILE
+    echo NIX_LDFLAGS: $NIX_LDFLAGS
+    for i in $(find $(pwd) -wholename '*/public/*.idl' -exec dirname '{}' ';' | sort | uniq); do
+      export XPIDL_FLAGS="$XPIDL_FLAGS -I$i";
+    done;
+    echo $XPIDL_FLAGS
+
+    sed -e "s@\$(XPIDL_FLAGS)@\$(XPIDL_FLAGS) $XPIDL_FLAGS@" -i config/rules.mk
+  '';
+  postConfigure = ''
+    (cd mozilla/nsprpub; ./configure --prefix=$out/XUL_SDK; )
+  '';
+  preBuild = ''
+    for i in $(find . -name autoconf.mk); do echo $i; sed -e 's@-Wl,-rpath-link,$(PREFIX)/lib@@' -i $i; done
+    make -C mozilla/config nsinstall
+    mkdir -p $out/libexec/mozilla/nsinstall
+    mv mozilla/config/nsinstall $out/libexec/mozilla/nsinstall/nsinstall
+    cat > mozilla/config/nsinstall <<EOF
+    #! /bin/sh
+    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${sqlite}/lib:${xulrunner}/lib/xulrunner-${xulrunner.version}"
+    $out/libexec/mozilla/nsinstall/nsinstall "\$@"
+    EOF
+    chmod a+x mozilla/config/nsinstall
+  '';
+
+  configureFlags = [
+    "--enable-application=mail"
+    "--enable-optimize"
+    "--disable-debug"
+    "--with-system-jpeg"
+    "--with-system-zlib"
+    "--with-system-bz2"
+    #"--with-system-png" # <-- "--with-system-png won't work because the system's libpng doesn't have APNG support"
+    "--enable-system-cairo"
+    #"--enable-system-sqlite" # <-- this seems to be discouraged
+    "--disable-crashreporter"
+    "--with-libxul-sdk=${xulrunner}/lib/xulrunner-devel-${xulrunner.version}"
+    "--enable-extensions=default"
+  ]
+  ++ (if enableOfficialBranding then ["--enable-official-branding"] else []);
+
+  postInstall = ''
+    # Strip some more stuff.
+    strip -S $out/lib/*/* || true
+
+    libDir=$(cd $out/lib && ls -d thunderbird-[0-9]*)
+    test -n "$libDir"
+    
+    ln -s ${xulrunner}/lib/xulrunner-${xulrunner.version} $out/lib/$libDir/xulrunner
+
+    # Register extensions etc. !!! is this needed anymore?
+    echo "running thunderbird -register..."
+    $out/bin/thunderbird -register
+  ''; # */
+
+  meta = {
+    description = "Mozilla Thunderbird, a full-featured email client";
+    homepage = http://www.mozilla.com/en-US/thunderbird/;
+  };
+
+  passthru = {
+    inherit gtk;
+  };
+}
diff --git a/pkgs/applications/networking/p2p/ldcpp/1.0.1.nix b/pkgs/applications/networking/p2p/ldcpp/1.0.1.nix
index 07e4a305060c..e4b1b0a1e172 100644
--- a/pkgs/applications/networking/p2p/ldcpp/1.0.1.nix
+++ b/pkgs/applications/networking/p2p/ldcpp/1.0.1.nix
@@ -23,9 +23,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[doScons doForceShare doPropagate]);
 	meta = {
-		description = "
-		Linux DC++ - Direct Connect client
-";
+		description = "Linux DC++ - Direct Connect client";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/science/biology/ncbi-tools/default.nix b/pkgs/applications/science/biology/ncbi-tools/default.nix
index 45460c4b1aa9..775e2ec3cc8c 100644
--- a/pkgs/applications/science/biology/ncbi-tools/default.nix
+++ b/pkgs/applications/science/biology/ncbi-tools/default.nix
@@ -1,21 +1,28 @@
 {stdenv, fetchurl, cpio}:
 
-# Note: may need the C-libs at ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools++/2008/Mar_17_2008/NCBI_C_Toolkit/ncbi_c--Mar_17_2008.tar.gz (or split out?)
+# The NCBI package only builds on 32bits - on 64bits it breaks because
+# of position dependent code. Debian packagers have written replacement
+# make files(!). Either we use these, or negotiate a version which can
+# be pushed upstream to NCBI.
+#
+# Another note: you may want the older and deprecated C-libs at ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools++/2008/Mar_17_2008/NCBI_C_Toolkit/ncbi_c--Mar_17_2008.tar.gz
 
 stdenv.mkDerivation rec {
-  name = "ncbi_cxx";
-  ncbi_version = "Mar_17_2008";
+  name = "ncbi_tools";
+  ncbi_version="Dec_31_2008";
   src = fetchurl {
     url = "ftp://ftp.ncbi.nih.gov/toolbox/ncbi_tools++/2008/${ncbi_version}/ncbi_cxx--${ncbi_version}.tar.gz";
-    sha256 = "0mxbmz6gndallz8l5jdslq6illa3hgf31xi2yb984mqm9in485as";
+    sha256 = "1b2v0dcdqn3bysgdkj57sxmd6s0hc9wpnxssviz399g6plhxggbr";
   };
 
   configureFlags = "--without-debug --with-bin-release --with-dll --without-static";
+  # PIC flag (position independent code for shared libraries)
+  NIX_CXXFLAGS_COMPILE = if stdenv.system == "x86_64-linux" then "-fPIC" else "";
   buildInputs = [cpio];
 
   meta = {
-    description = ''NCBI Bioinformatics toolbox (incl. blast)'';
-    longDescription = ''The NCBI Bioinformatics toolsbox, including command-line utilties, libraries and include files. No X11 support (at this point).'';
+    description = ''NCBI Bioinformatics toolbox (incl. BLAST)'';
+    longDescription = ''The NCBI Bioinformatics toolsbox, including command-line utilties, libraries and include files. No X11 support'';
     homepage = http://www.ncbi.nlm.nih.gov/IEB/ToolBox/; 
     license = "GPL";
     priority = "5";   # zlib.so gives a conflict with zlib
diff --git a/pkgs/applications/science/biology/paml/default.nix b/pkgs/applications/science/biology/paml/default.nix
index dc1bb206aaf5..cec0aa7e5eba 100644
--- a/pkgs/applications/science/biology/paml/default.nix
+++ b/pkgs/applications/science/biology/paml/default.nix
@@ -1,10 +1,11 @@
 {stdenv, fetchurl}:
 
-stdenv.mkDerivation {
-  name = "paml-4.1";
+stdenv.mkDerivation rec {
+  version = "4.2a";
+  name = "paml-${version}";
   src = fetchurl {
-    url = http://abacus.gene.ucl.ac.uk/software/paml4.1.tar.gz;
-    sha256 = "1w8ih7h9xfbnmzmbql5l1hjkgzp17wjvxjfgc76zbcsb61b0ls34";
+    url = "http://abacus.gene.ucl.ac.uk/software/paml${version}.tar.gz";
+    sha256 = "0yywyrjgxrpavp50n00l01pl90b7pykgb2k53yrlykz9dnf583pb";
   };
 
   preBuild = ''
diff --git a/pkgs/applications/version-management/arch/default.nix b/pkgs/applications/version-management/arch/default.nix
index 0a54eabd5953..763a84fab9f4 100644
--- a/pkgs/applications/version-management/arch/default.nix
+++ b/pkgs/applications/version-management/arch/default.nix
@@ -21,8 +21,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = {
-    description = ''GNU Arch (aka. `tla'), a distributed revision
-    		    control system.'';
+    description = "GNU Arch (aka. `tla'), a distributed revision control system";
     homepage = http://www.gnu.org/software/gnu-arch/;
     license = "GPL";
   };
diff --git a/pkgs/applications/version-management/cvsps/default.nix b/pkgs/applications/version-management/cvsps/default.nix
index bea43f77d069..1be797fea966 100644
--- a/pkgs/applications/version-management/cvsps/default.nix
+++ b/pkgs/applications/version-management/cvsps/default.nix
@@ -17,11 +17,12 @@ stdenv.mkDerivation rec {
   installPhase = "make install prefix=$out";
 
   meta = {
-    description = ''CVSps is a program for generating `patchset' information
-                    from a CVS repository.  A patchset in this case is
-		    defined as a set of changes made to a collection of
-		    files, and all committed at the same time (using a single
-		    "cvs commit" command).'';
+    longDescription = ''
+      CVSps is a program for generating `patchset' information from a
+      CVS repository.  A patchset in this case is defined as a set of
+      changes made to a collection of files, and all committed at the
+      same time (using a single "cvs commit" command).
+    '';
     homepage = http://www.cobite.com/cvsps/;
     license = "GPLv2";
   };
diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index 9506e7a5f0ef..d16b166416fc 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -63,6 +63,24 @@ rec {
     };
   };
 
+  tig = stdenv.mkDerivation {
+    name = "tig-0.14.1";
+    src = fetchurl {
+      url = "http://jonas.nitro.dk/tig/releases/tig-0.14.1.tar.gz";
+      sha256 = "1a8mi1pv36v67n31vs95gcibkifnqq5s1x69lz1cz0218yv9s73r";
+    };
+    buildInputs = [ncurses asciidoc xmlto docbook_xsl];
+    installPhase = ''
+      make install
+      make install-doc
+    '';
+    meta = {
+      description = "console git repository browser that additionally can act as a pager for output from various git commands";
+      homepage = http://jonas.nitro.dk/tig/;
+      license = "GPLv2";
+    };
+  };
+
   hg2git = import ./hg2git {
     inherit fetchurl stdenv mercurial coreutils git makeWrapper;
     inherit (bleedingEdgeRepos) sourceByName;
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index 7824eaf69735..1916e58cacd0 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -10,14 +10,14 @@ assert svnSupport -> (subversion != null && perlLibs != [] && subversion.perlBin
 
 
 stdenv.mkDerivation rec {
-  name = "git-1.6.0.4";
+  name = "git-1.6.1.3";
 
   src = fetchurl {
     url = "mirror://kernel/software/scm/git/${name}.tar.bz2";
-    sha256 = "0q5jnix65zn58dhd9xc3sjpamli0lh1bnsz1b9riwwicgwssrk7q";
+    sha256 = "aef4814634ac9ce8119fabc4bd1c363bb946f73ed34475a4baaad09a3fb23682";
   };
 
-  patches = [ ./docbook2texi.patch ];
+  patches = [ ./docbook2texi.patch ./fill-paragraph.patch ];
 
   buildInputs = [curl openssl zlib expat gettext cpio makeWrapper]
     ++ # documentation tools
diff --git a/pkgs/applications/version-management/git-and-tools/git/fill-paragraph.patch b/pkgs/applications/version-management/git-and-tools/git/fill-paragraph.patch
new file mode 100644
index 000000000000..59d6d6b3d332
--- /dev/null
+++ b/pkgs/applications/version-management/git-and-tools/git/fill-paragraph.patch
@@ -0,0 +1,11 @@
+diff --git a/contrib/emacs/git.el b/contrib/emacs/git.el
+index 3c37d0d..e314c44 100644
+--- a/contrib/emacs/git.el
++++ b/contrib/emacs/git.el
+@@ -1331,6 +1331,7 @@ Return the list of files that haven't been handled."
+ 					 (log-edit-diff-function . git-log-edit-diff)) buffer)
+ 	(log-edit 'git-do-commit nil 'git-log-edit-files buffer))
+       (setq font-lock-keywords (font-lock-compile-keywords git-log-edit-font-lock-keywords))
++      (setq paragraph-separate (concat (regexp-quote git-log-msg-separator) "$\\|Author: \\|Date: \\|Merge: \\|Signed-off-by: \\|\f\\|[ 	]*$"))
+       (setq buffer-file-coding-system coding-system)
+       (re-search-forward (regexp-quote (concat git-log-msg-separator "\n")) nil t))))
diff --git a/pkgs/applications/video/MPlayer/default.nix b/pkgs/applications/video/MPlayer/default.nix
index 6eb8fb84e946..ed65e76414a2 100644
--- a/pkgs/applications/video/MPlayer/default.nix
+++ b/pkgs/applications/video/MPlayer/default.nix
@@ -4,8 +4,6 @@
 , alsa ? null, libX11, libXv ? null, libtheora ? null, libcaca ? null
 , libXinerama ? null, libXrandr ? null, libdvdnav ? null
 , cdparanoia ? null, cddaSupport ? true
-, extraBuildInputs ? []
-, extraConfigureFlags ? ""
 }:
 
 assert alsaSupport -> alsa != null;
@@ -30,53 +28,42 @@ let
 in
 
 stdenv.mkDerivation {
-  name = "MPlayer-1.0rc2";
+  name = "MPlayer-1.0rc2-r28450";
 
   src = fetchurl {
-    url = http://www1.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2;
-    sha1 = "e9b496f3527c552004ec6d01d6b43f196b43ce2d";
+    url = mirror://gentoo/distfiles/mplayer-1.0_rc2_p28450.tar.bz2;
+    sha256 = "0cbils58mq20nablywgjfpfx2pzjgnhin23sb8k1s5h2rxgvi3vf";
   };
 
-  buildInputs = [
-    x11 libXv freetype zlib
-    (if alsaSupport then alsa else null)
-    (if xvSupport then libXv else null)
-    (if theoraSupport then libtheora else null)
-    (if cacaSupport then libcaca else null)
-    (if xineramaSupport then libXinerama else null)
-    (if randrSupport then libXrandr else null)
-    (if dvdnavSupport then libdvdnav else null)
-    (if cddaSupport then cdparanoia else null)
-  ]
-  ++ extraBuildInputs
-  ;
+  buildInputs =
+    [x11 libXv freetype zlib]
+    ++ stdenv.lib.optional alsaSupport alsa
+    ++ stdenv.lib.optional xvSupport libXv
+    ++ stdenv.lib.optional theoraSupport libtheora
+    ++ stdenv.lib.optional cacaSupport libcaca
+    ++ stdenv.lib.optional xineramaSupport libXinerama
+    ++ stdenv.lib.optional randrSupport libXrandr
+    ++ stdenv.lib.optionals dvdnavSupport [libdvdnav libdvdnav.libdvdread]
+    ++ stdenv.lib.optional cddaSupport cdparanoia;
 
-  configureFlags = "
+  configureFlags = ''
     ${if cacaSupport then "--enable-caca" else "--disable-caca"}
-    ${if dvdnavSupport then "--enable-dvdnav" else ""}
+    ${if dvdnavSupport then "--enable-dvdnav --enable-dvdread --disable-dvdread-internal" else ""}
     --win32codecsdir=${win32codecs}
     --realcodecsdir=${rp9codecs}
     --enable-runtime-cpudetection
     --enable-x11 --with-extraincdir=${libX11}/include
     --disable-xanim
     --disable-ivtv
-  "
-  + extraConfigureFlags
-  ;
+  '';
 
-  NIX_LDFLAGS = "-lX11 -lXext "  # !!! hack, necessary to get libX11/Xext in the RPATH
-    + (if dvdnavSupport then "-ldvdnav" else "");
+  NIX_LDFLAGS = "-lX11 -lXext";
 
   # 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
-  ];
+  postInstall = ''
+    ensureDir $out/share/mplayer
+    cp ${freefont_ttf}/share/fonts/truetype/FreeSans.ttf $out/share/mplayer/subfont.ttf
+  '';
 
   meta = {
     description = "A movie player that supports many video formats";
diff --git a/pkgs/applications/video/MPlayer/win32codecs/default.nix b/pkgs/applications/video/MPlayer/win32codecs/default.nix
index 36de4cef857b..e4e73f6ede35 100644
--- a/pkgs/applications/video/MPlayer/win32codecs/default.nix
+++ b/pkgs/applications/video/MPlayer/win32codecs/default.nix
@@ -1,8 +1,16 @@
-{stdenv, fetchurl}: stdenv.mkDerivation {
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
   name = "MPlayer-codecs-essential-20071007";
+  
   builder = ./builder.sh;
+  
   src = fetchurl {
     url = http://www2.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2;
     sha256 = "18vls12n12rjw0mzw4pkp9vpcfmd1c21rzha19d7zil4hn7fs2ic";
   };
+
+  meta = {
+    license = "unfree";
+  };
 }
diff --git a/pkgs/applications/video/gnash/default.nix b/pkgs/applications/video/gnash/default.nix
index b0151ba4dcb6..c3a4944ec639 100644
--- a/pkgs/applications/video/gnash/default.nix
+++ b/pkgs/applications/video/gnash/default.nix
@@ -5,13 +5,13 @@
 , glib, gtk, x11, ming, dejagnu, python
 , lib, makeWrapper }:
 
-let version = "0.8.4"; in
+let version = "0.8.5"; in
 stdenv.mkDerivation rec {
   name = "gnash-${version}";
 
   src = fetchurl {
     url = "mirror://gnu/gnash/${version}/${name}.tar.bz2";
-    sha256 = "094jky77ghdisq17z742cwn3g9ckm937p8h5jbji5rrdqbdlpzkg";
+    sha256 = "1cqhnbp99rb0n4x2bsz8wwh7vvc2kclxc1wmrl5vaapd9qhp5whn";
   };
 
   builder = ./builder.sh;
diff --git a/pkgs/applications/video/vlc/default.nix b/pkgs/applications/video/vlc/default.nix
index b774cd28b62c..e1b2d5d7eeff 100644
--- a/pkgs/applications/video/vlc/default.nix
+++ b/pkgs/applications/video/vlc/default.nix
@@ -1,31 +1,28 @@
-{ xvSupport ? true
-, stdenv, fetchurl, perl, x11, libXv, wxGTK
-, libdvdread, libdvdnav, libdvdcss
-, zlib, mpeg2dec, a52dec, libmad, ffmpeg, alsa
+{ stdenv, fetchurl, perl, xlibs, libdvdnav
+, zlib, a52dec, libmad, faad2, ffmpeg, alsa
+, pkgconfig, dbus, hal, fribidi, qt4, freefont_ttf
 }:
 
-assert libdvdread.libdvdcss == libdvdcss;
-assert xvSupport -> libXv != null;
-
 stdenv.mkDerivation {
-  name = "vlc-0.8.6h";
+  name = "vlc-0.9.8a";
 
   src = fetchurl {
-    url = http://download.videolan.org/pub/videolan/vlc/0.8.6h/vlc-0.8.6h.tar.bz2;
-    sha256 = "08bj6ndxj0f7jdsif43535qyavpy13wni93z7c2790i2d748gvah";
+    url = http://download.videolan.org/pub/videolan/vlc/0.9.8a/vlc-0.9.8a.tar.bz2;
+    sha256 = "0kw2d7yh8rzb61j1q2cvnjinj1wxc9a7smxl7ckw1vwh6y02jz0r";
   };
 
   buildInputs = [
-    perl x11 wxGTK 
-    zlib mpeg2dec a52dec libmad ffmpeg alsa
-    libdvdread # <- for "simple" DVD playback
-    libdvdnav libdvdcss # <- for DVD playback with menus
-  ] ++ stdenv.lib.optional xvSupport libXv;
+    perl xlibs.xlibs xlibs.libXv zlib a52dec libmad faad2 ffmpeg
+    alsa libdvdnav libdvdnav.libdvdread pkgconfig dbus hal fribidi qt4
+  ];
 
-  # Ensure that libdvdcss will be found without having to set LD_LIBRARY_PATH.
-  NIX_LDFLAGS = "-ldvdcss";
+  configureFlags = "--enable-alsa --disable-glx --disable-remoteosd --enable-faad";
 
-  configureFlags = "--enable-alsa";
+  preBuild = ''
+    substituteInPlace modules/misc/freetype.c --replace \
+      /usr/share/fonts/truetype/freefont/FreeSerifBold.ttf \
+      ${freefont_ttf}/share/fonts/truetype/FreeSerifBold.ttf
+  '';
 
   meta = {
     description = "Cross-platform media player and streaming server";
diff --git a/pkgs/applications/virtualization/qemu/svn-6642.nix b/pkgs/applications/virtualization/qemu/svn-6642.nix
new file mode 100644
index 000000000000..32d67234ba73
--- /dev/null
+++ b/pkgs/applications/virtualization/qemu/svn-6642.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchsvn, SDL, zlib, which}:
+
+stdenv.mkDerivation {
+  name = "qemu-svn-6642";
+
+  src = fetchsvn {
+  	url = "svn://svn.sv.gnu.org/qemu/trunk";
+	rev = "6642";
+	sha256 = "12445ad91feb72eecd1db0d4319a8fa5d7dc971b89228bd0e121b49c5da9705e";
+  };
+
+  patchFlags = "-p2";
+  
+  buildInputs = [SDL zlib which];
+  
+  meta = {
+    description = "QEmu processor emulator";
+  };
+}
diff --git a/pkgs/applications/window-managers/compiz/0.6.2.nix b/pkgs/applications/window-managers/compiz/0.6.2.nix
index 9531fdc3f6d8..0c89087d02a9 100644
--- a/pkgs/applications/window-managers/compiz/0.6.2.nix
+++ b/pkgs/applications/window-managers/compiz/0.6.2.nix
@@ -41,9 +41,7 @@ rec {
 			doForceShare postAll]);
 	inherit propagatedBuildInputs;
 	meta = {
-		description = "
-	Compiz window manager
-";
+		description = "Compiz window manager";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/window-managers/compiz/0.7.8.nix b/pkgs/applications/window-managers/compiz/0.7.8.nix
index e6447b68bdba..0e7cfc2910de 100644
--- a/pkgs/applications/window-managers/compiz/0.7.8.nix
+++ b/pkgs/applications/window-managers/compiz/0.7.8.nix
@@ -42,9 +42,7 @@ rec {
 			doForceShare postAll]);
 	inherit propagatedBuildInputs;
 	meta = {
-		description = "
-	Compiz window manager
-";
+		description = "Compiz window manager";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/window-managers/compiz/0.8.0.nix b/pkgs/applications/window-managers/compiz/0.8.0.nix
new file mode 100644
index 000000000000..d521b2a4fa3f
--- /dev/null
+++ b/pkgs/applications/window-managers/compiz/0.8.0.nix
@@ -0,0 +1,48 @@
+args : with args;
+	let localDefs = builderDefs.passthru.function {
+		src = /* put a fetchurl here */
+		  fetchurl {
+		    url = "http://releases.compiz-fusion.org/core/compiz-0.8.0.tar.gz";
+		    sha256 = "0xhyilfz2cfbdwni774b54171addjqw7hda6j6snzxb1igny7iry";
+		  };
+		buildInputs = [
+			    pkgconfig gtk libwnck GConf libgnome 
+			    libgnomeui metacity gnomegtk glib pango libglade libgtkhtml 
+			    gtkhtml libgnomecanvas libgnomeprint libgnomeprintui gnomepanel 
+			    librsvg fuse gettext intltool
+		];
+		  propagatedBuildInputs = [
+		    libpng libXcomposite libXfixes libXdamage libXrandr libXinerama
+		    libICE libSM startupnotification mesa GConf perl perlXMLParser libxslt
+		    dbus.libs dbus_glib compositeproto fixesproto damageproto randrproto
+		    xineramaproto renderproto kbproto xextproto libXrender xproto libX11
+		    libxcb
+		  ];
+		configureFlags = ["--enable-gtk" "--enable-fuse" 
+			"--enable-annotate" "--enable-librsvg"] ++ 
+			(if args ? extraConfigureFlags then args.extraConfigureFlags else []);
+	};
+	in with localDefs;
+let
+	postAll = FullDepEntry ("
+    for i in $out/bin/*; do
+     patchelf --set-rpath /var/run/opengl-driver/lib:$(patchelf --print-rpath $i) $i
+    done
+    ensureDir \$out/share/compiz-plugins/
+    ln -sfv \$out/lib/compiz \$out/share/compiz-plugins/
+  ") [minInit doMakeInstall defEnsureDir];
+in
+
+stdenv.mkDerivation 
+rec {
+	name = "compiz-0.8.0";
+	builder = writeScript (name + "-builder")
+		(textClosure localDefs [doPatch doConfigure doMakeInstall doPropagate 
+			doForceShare postAll]);
+	inherit propagatedBuildInputs;
+	meta = {
+		description = "Compiz window manager";
+		inherit src;
+	};
+}
+
diff --git a/pkgs/applications/window-managers/fbpanel/4.12.nix b/pkgs/applications/window-managers/fbpanel/4.12.nix
index b4d83d9d1d01..e39aa72e8cf7 100644
--- a/pkgs/applications/window-managers/fbpanel/4.12.nix
+++ b/pkgs/applications/window-managers/fbpanel/4.12.nix
@@ -16,9 +16,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	Just a desktop panel.	
-";
+		description = "Just a desktop panel";
 		inherit src;
 	};
 }
diff --git a/pkgs/applications/window-managers/jwm/default.nix b/pkgs/applications/window-managers/jwm/default.nix
index 932e609feb2f..021681e4efd1 100644
--- a/pkgs/applications/window-managers/jwm/default.nix
+++ b/pkgs/applications/window-managers/jwm/default.nix
@@ -9,14 +9,11 @@ stdenv.mkDerivation {
 
   buildInputs = [libX11 libXext libXinerama libXpm libXft];
 
-
   postInstall = ''
     sed -i -e s/rxvt/xterm/g $out/etc/system.jwmrc
     sed -i -e "s/.*Swallow.*\|.*xload.*//" $out/etc/system.jwmrc'';
 
-
   meta = {
-  description = "JWM is a window manager for X11 window system. It is written in C and uses only Xlib at a minimum.";
+    description = "A window manager for X11 that requires only Xlib";
   };
-
 }
diff --git a/pkgs/applications/window-managers/wmii/default.nix b/pkgs/applications/window-managers/wmii/default.nix
index 396f69181b69..0750fc7b12dd 100644
--- a/pkgs/applications/window-managers/wmii/default.nix
+++ b/pkgs/applications/window-managers/wmii/default.nix
@@ -1,9 +1,9 @@
 args: with args; stdenv.mkDerivation {
-  name = "wmii-20070516";
+  name = "wmii-20071116";
 
   src = fetchurl {
-    url = http://www.suckless.org/download/wmii-3.6.tar.gz;
-    sha256 = "05mj651yv02rvkpqqkgwp8307nrrqpcwfv5k8186kx2yiiw9pws6";
+    url = http://code.suckless.org/dl/wmii/wmii-3.6.tar.gz;
+    sha256 = "46f39b788c5ef4695040b36cc7d9c539db0306bafc4d8cefdc5980ed4331b216";
   };
 
   buildInputs = [ libX11 libixp xextproto libXt libXext ];
diff --git a/pkgs/build-support/buildenv/builder.pl b/pkgs/build-support/buildenv/builder.pl
index eb8490080558..2da4311b3887 100755
--- a/pkgs/build-support/buildenv/builder.pl
+++ b/pkgs/build-support/buildenv/builder.pl
@@ -165,3 +165,7 @@ my $manifest = $ENV{"manifest"};
 if ($manifest ne "") {
     symlink($manifest, "$out/manifest") or die "cannot create manifest";
 }
+
+
+system("eval \"\$postBuild\"") == 0
+    or die "post-build hook failed";
diff --git a/pkgs/build-support/buildenv/default.nix b/pkgs/build-support/buildenv/default.nix
index 95f5f2304c01..abe2f37ec660 100644
--- a/pkgs/build-support/buildenv/default.nix
+++ b/pkgs/build-support/buildenv/default.nix
@@ -20,11 +20,13 @@
   # symlink (e.g., ["/bin"]).  Any file not inside any of the
   # directories in the list is not symlinked.
   pathsToLink ? ["/"]
+
+, # Shell command to run after building the symlink tree.
+  postBuild ? ""
 }:
 
 stdenv.mkDerivation {
-  inherit name manifest paths ignoreCollisions pathsToLink;
-  realBuilder = perl + "/bin/perl";
+  inherit name manifest paths ignoreCollisions pathsToLink postBuild;
+  realBuilder = "${perl}/bin/perl";
   args = ["-w" ./builder.pl];
 }
-
diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix
index 9b8eecf9a951..613b33cffdc1 100644
--- a/pkgs/build-support/fetchurl/mirrors.nix
+++ b/pkgs/build-support/fetchurl/mirrors.nix
@@ -93,7 +93,6 @@ rec {
 
   # Mirrors of ftp://ftp.kde.org/pub/kde/.
   kde = [
-    http://ftp.scarlet.be/pub/kde/
     http://ftp.gwdg.de/pub/x11/kde/
     ftp://ftp.heanet.ie/mirrors/ftp.kde.org/
     ftp://ftp.kde.org/pub/kde/
@@ -101,7 +100,7 @@ rec {
 
   # Gentoo files.
   gentoo = [
-    http://www.ibiblio.org/pub/Linux/distributions/gentoo/
+    http://ftp.snt.utwente.nl/pub/os/linux/gentoo/
     http://distfiles.gentoo.org/
   ];
 
diff --git a/pkgs/build-support/make-wrapper/make-wrapper.sh b/pkgs/build-support/make-wrapper/make-wrapper.sh
index c13f623bcda0..f1d1da0ba421 100644
--- a/pkgs/build-support/make-wrapper/make-wrapper.sh
+++ b/pkgs/build-support/make-wrapper/make-wrapper.sh
@@ -66,7 +66,7 @@ makeWrapper() {
         fi
     done
 
-    echo "exec \"$original\" $flagsBefore \"\$@\"" >> $wrapper
+    echo "exec -a $(basename "$wrapper") \"$original\" $flagsBefore \"\$@\"" >> $wrapper
     
     chmod +x $wrapper
 }
diff --git a/pkgs/build-support/release/debian-build.nix b/pkgs/build-support/release/debian-build.nix
index fad88a98f177..d41750733b5d 100644
--- a/pkgs/build-support/release/debian-build.nix
+++ b/pkgs/build-support/release/debian-build.nix
@@ -1,13 +1,14 @@
 # This function compiles a source tarball in a virtual machine image
 # that contains a Debian-like (i.e. dpkg-based) OS.
 
-{vmTools, fetchurl}: args: with args;
+{ name ? "debian-build"
+, diskImage
+, src, stdenv, vmTools, checkinstall
+, ... } @ args:
 
 vmTools.runInLinuxImage (stdenv.mkDerivation (
 
   {
-    name = "debian-build";
-
     doCheck = true;
 
     prefix = "/usr";
@@ -15,11 +16,11 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
     phases = "installExtraDebsPhase sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase distPhase";
   }
 
-  // args //
+  // removeAttrs args ["vmTools"] //
 
   {
-    src = src.path;
-  
+    name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
+
     # !!! cut&paste from rpm-build.nix
     postHook = ''
       ensureDir $out/nix-support
@@ -50,7 +51,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
 
     installCommand = ''
       export LOGNAME=root
-    
+
       ${checkinstall}/sbin/checkinstall -y -D make install
 
       ensureDir $out/debs
@@ -66,7 +67,7 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
     ''; # */
 
     meta = (if args ? meta then args.meta else {}) // {
-      description = "Build of a Deb package on ${args.diskImage.fullName} (${args.diskImage.name})";
+      description = "Build of a Deb package on ${diskImage.fullName} (${diskImage.name})";
     };
   }
 
diff --git a/pkgs/build-support/release/default.nix b/pkgs/build-support/release/default.nix
index 789def4ddffc..0c0ee1bec555 100644
--- a/pkgs/build-support/release/default.nix
+++ b/pkgs/build-support/release/default.nix
@@ -17,10 +17,12 @@ rec {
       doCoverageAnalysis = true;
     } // args);
 
-  rpmBuild = args: import ./rpm-build.nix vmTools args;
+  rpmBuild = args: import ./rpm-build.nix (
+    { inherit vmTools;
+    } // args);
 
-  debBuild = args: import ./debian-build.nix {inherit vmTools fetchurl;} (
-    { inherit stdenv checkinstall;
+  debBuild = args: import ./debian-build.nix (
+    { inherit stdenv vmTools checkinstall;
     } // args);
 
 }
diff --git a/pkgs/build-support/release/make-source-tarball.nix b/pkgs/build-support/release/make-source-tarball.nix
index 806246db7945..2e40ad2d6231 100644
--- a/pkgs/build-support/release/make-source-tarball.nix
+++ b/pkgs/build-support/release/make-source-tarball.nix
@@ -4,6 +4,8 @@
 
 { officialRelease ? false
 , buildInputs ? []
+, name ? "source-tarball"
+, version ? "0"
 , src, stdenv, autoconf, automake, libtool
 , ... } @ args:
 
@@ -20,8 +22,6 @@ stdenv.mkDerivation (
 
   # First, attributes that can be overriden by the caller (via args):
   {
-    name = "source-tarball";
-
     # By default, only configure and build a source distribution.
     # Some packages can only build a distribution after a general
     # `make' (or even `make install').
@@ -43,7 +43,7 @@ stdenv.mkDerivation (
 
   # And finally, our own stuff.
   {
-    src = src.path;
+    name = name + "-" + version + versionSuffix;
 
     buildInputs = buildInputs ++ [autoconf automake libtool];
     
@@ -66,6 +66,7 @@ stdenv.mkDerivation (
 
     # Autoconfiscate the sources.
     autoconfPhase = ''
+      export VERSION=${version}
       export VERSION_SUFFIX=${versionSuffix}
     
       eval "$preAutoconf"
@@ -96,12 +97,14 @@ stdenv.mkDerivation (
       test -n "$releaseName" && (echo "$releaseName" >> $out/nix-support/hydra-release-name)
     ''; # */
 
-    passthru = {inherit src;};
+    passthru = {
+      inherit src;
+      version = version + versionSuffix;
+    };
 
     meta = (if args ? meta then args.meta else {}) // {
       description = "Build of a source distribution from a checkout";
     };
-  
   }
 
 )
diff --git a/pkgs/build-support/release/nix-build.nix b/pkgs/build-support/release/nix-build.nix
index 5f127265d4a8..f9d2351d9253 100644
--- a/pkgs/build-support/release/nix-build.nix
+++ b/pkgs/build-support/release/nix-build.nix
@@ -8,13 +8,12 @@
 { doCoverageAnalysis ? false
 , lcovFilter ? []
 , src, stdenv
+, name ? if doCoverageAnalysis then "nix-coverage" else "nix-build"
 , ... } @ args:
 
 stdenv.mkDerivation (
 
   {
-    name = "nix-build";
-
     # Also run a `make check'.
     doCheck = true;
 
@@ -24,14 +23,14 @@ stdenv.mkDerivation (
     showBuildStats = true;
 
     # Hack - swap checkPhase and installPhase (otherwise Stratego barfs).
-    phases = "unpackPhase patchPhase configurePhase buildPhase installPhase checkPhase fixupPhase distPhase ${if doCoverageAnalysis then "coverageReportPhase" else ""}";
+    phases = "unpackPhase patchPhase configurePhase buildPhase installPhase checkPhase fixupPhase distPhase ${if doCoverageAnalysis then "coverageReportPhase" else ""} finalPhase";
   }
 
   // args // 
 
   {
-    src = src.path;
-
+    name = name + (if src ? version then "-" + src.version else "");
+  
     postHook = ''
       ensureDir $out/nix-support
       echo "$system" > $out/nix-support/system
@@ -43,7 +42,7 @@ stdenv.mkDerivation (
       # If `src' is the result of a call to `makeSourceTarball', then it
       # has a subdirectory containing the actual tarball(s).  If there are
       # multiple tarballs, just pick the first one.
-      echo $src
+      origSrc=$src
       if test -d $src/tarballs; then
           src=$(ls $src/tarballs/*.tar.bz2 $src/tarballs/*.tar.gz | sort | head -1)
       fi
@@ -85,6 +84,16 @@ stdenv.mkDerivation (
 
 
     lcovFilter = ["/nix/store/*"] ++ lcovFilter;
+
+
+    finalPhase =
+      ''
+        # Propagate the release name of the source tarball.  This is
+        # to get nice package names in channels.
+        if test -e $origSrc/nix-support/hydra-release-name; then
+          cp $origSrc/nix-support/hydra-release-name $out/nix-support/hydra-release-name
+        fi
+      '';
     
 
     meta = (if args ? meta then args.meta else {}) // {
diff --git a/pkgs/build-support/release/rpm-build.nix b/pkgs/build-support/release/rpm-build.nix
index 88273b5958cc..97e86dd3c68a 100644
--- a/pkgs/build-support/release/rpm-build.nix
+++ b/pkgs/build-support/release/rpm-build.nix
@@ -1,18 +1,17 @@
 # This function builds an RPM from a source tarball that contains a
 # RPM spec file (i.e., one that can be built using `rpmbuild -ta').
 
-vmTools: args: with args;
+{ name ? "rpm-build"
+, diskImage
+, src, vmTools
+, ... } @ args:
 
 vmTools.buildRPM (
 
-  {
-    name = "rpm-build";
-  }
-
-  // args //
+  removeAttrs args ["vmTools"] //
 
   {
-    src = src.path;
+    name = name + "-" + diskImage.name + (if src ? version then "-" + src.version else "");
 
     preBuild = ''
       ensureDir $out/nix-support
@@ -34,7 +33,7 @@ vmTools.buildRPM (
     ''; # */
 
     meta = (if args ? meta then args.meta else {}) // {
-      description = "Build of an RPM package on ${args.diskImage.fullName} (${args.diskImage.name})";
+      description = "Build of an RPM package on ${diskImage.fullName} (${diskImage.name})";
     };
   }
 
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index b0dcb23c09e5..d8d2a8db522f 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -31,6 +31,15 @@ rec {
     allowedReferences = []; # prevent accidents like glibc being included in the initrd
   };
 
+
+  createDeviceNodes = dev:
+    ''
+      mknod ${dev}/null c 1 3
+      mknod ${dev}/zero c 1 5
+      mknod ${dev}/tty  c 5 0
+      mknod ${dev}/vda  b 253 0
+    '';
+
   
   stage1Init = writeScript "vm-run-stage1" ''
     #! ${klibcShrunk}/bin/sh.shared -e
@@ -75,10 +84,7 @@ rec {
     done
 
     mount -t tmpfs none /dev
-    mknod /dev/null c 1 3
-    mknod /dev/zero c 1 5
-    mknod /dev/tty  c 5 0
-    mknod /dev/vda  b 253 0
+    ${createDeviceNodes "/dev"}
     
     ipconfig 10.0.2.15:::::eth0:none
 
@@ -211,8 +217,8 @@ rec {
 
   createEmptyImage = {size, fullName}: ''
     mkdir $out
-    diskImage=$out/image
-    qemu-img create -f qcow $diskImage "${toString size}M"
+    diskImage=$out/disk-image.qcow2
+    qemu-img create -f qcow2 $diskImage "${toString size}M"
 
     mkdir $out/nix-support
     echo "${fullName}" > $out/nix-support/full-name
@@ -230,6 +236,7 @@ rec {
     touch /mnt/.debug
 
     mkdir /mnt/proc /mnt/dev /mnt/sys /mnt/bin
+    ${createDeviceNodes "/mnt/dev"}
   '';
 
 
@@ -305,10 +312,10 @@ rec {
     QEMU_OPTS = "-m ${toString (if attrs ? memSize then attrs.memSize else 256)}";
 
     preVM = ''
-      diskImage=$(pwd)/image
+      diskImage=$(pwd)/disk-image.qcow2
       origImage=${attrs.diskImage}
-      if test -d "$origImage"; then origImage="$origImage/image"; fi
-      qemu-img create -b "$origImage" -f qcow $diskImage
+      if test -d "$origImage"; then origImage="$origImage/disk-image.qcow2"; fi
+      qemu-img create -b "$origImage" -f qcow2 $diskImage
 
       echo "$buildCommand" > cmd
 
@@ -332,10 +339,10 @@ rec {
     /* Mount `image' as the root FS, but use a temporary copy-on-write
        image since we don't want to (and can't) write to `image'. */
     preVM = ''
-      diskImage=$(pwd)/image
+      diskImage=$(pwd)/disk-image.qcow2
       origImage=${attrs.diskImage}
-      if test -d "$origImage"; then origImage="$origImage/image"; fi
-      qemu-img create -b "$origImage" -f qcow $diskImage
+      if test -d "$origImage"; then origImage="$origImage/disk-image.qcow2"; fi
+      qemu-img create -b "$origImage" -f qcow2 $diskImage
     '';
 
     /* Inside the VM, run the stdenv setup script normally, but at the
@@ -416,7 +423,7 @@ rec {
     fi
     diskImage="$1"
     if ! test -e "$diskImage"; then
-      qemu-img create -b ${image}/image -f qcow "$diskImage"
+      qemu-img create -b ${image}/disk-image.qcow2 -f qcow2 "$diskImage"
     fi
     export TMPDIR=$(mktemp -d)
     export out=/dummy
@@ -748,6 +755,28 @@ rec {
       archs = ["noarch" "i586"];
     } // args);
 
+    opensuse110i386 = args: makeImageFromRPMDist ({
+      name = "opensuse-11.0-i586";
+      fullName = "openSUSE 11.0 (i586)";
+      packagesList = fetchurl {
+        url = mirror://opensuse/distribution/11.0/repo/oss/suse/repodata/primary.xml.gz;
+        sha256 = "13rv855aj8p3h1zpsji5xa1wpkhgq94gcxzvg05l2b68b15q3mwn";
+      };
+      urlPrefix = mirror://opensuse/distribution/11.0/repo/oss/suse/;
+      archs = ["noarch" "i586"];
+    } // args);
+
+    opensuse110x86_64 = args: makeImageFromRPMDist ({
+      name = "opensuse-11.0-x86_64";
+      fullName = "openSUSE 11.0 (x86_64)";
+      packagesList = fetchurl {
+        url = mirror://opensuse/distribution/11.0/repo/oss/suse/repodata/primary.xml.gz;
+        sha256 = "13rv855aj8p3h1zpsji5xa1wpkhgq94gcxzvg05l2b68b15q3mwn";
+      };
+      urlPrefix = mirror://opensuse/distribution/11.0/repo/oss/suse/;
+      archs = ["noarch" "x86_64"];
+    } // args);
+
     # Interestingly, the SHA-256 hashes provided by Ubuntu in
     # http://nl.archive.ubuntu.com/ubuntu/dists/{gutsy,hardy}/Release are
     # wrong, but the SHA-1 and MD5 hashes are correct.  Intrepid is fine.
@@ -797,27 +826,47 @@ rec {
       fullName = "Ubuntu 8.10 Intrepid (amd64)";
       packagesList = fetchurl {
         url = mirror://ubuntu/dists/intrepid/main/binary-amd64/Packages.bz2;
-        sha1 = "01b2f3842cbdd5834446ddf91691bcf60f59a726dcefa23fb5b93fdc8ea7e27f";
+        sha256 = "01b2f3842cbdd5834446ddf91691bcf60f59a726dcefa23fb5b93fdc8ea7e27f";
       };
       urlPrefix = mirror://ubuntu;
     } // args);
          
     debian40i386 = args: makeImageFromDebDist ({
-      name = "debian-4.0r5-etch-i386";
-      fullName = "Debian 4.0r5 Etch (i386)";
+      name = "debian-4.0r7-etch-i386";
+      fullName = "Debian 4.0r7 Etch (i386)";
       packagesList = fetchurl {
         url = mirror://debian/dists/etch/main/binary-i386/Packages.bz2;
-        sha256 = "37a5c17fd8d62b1d9a0264a702025a4381c1a8751e2550d101957d8fa724a6f4";
+        sha256 = "155c1d1b4ce54de6c8134ab0154c2a476ae40cc5899109f3f95fecd5e002c50d";
       };
       urlPrefix = mirror://debian;
     } // args);
         
     debian40x86_64 = args: makeImageFromDebDist ({
-      name = "debian-4.0r5-etch-amd64";
-      fullName = "Debian 4.0r5 Etch (amd64)";
+      name = "debian-4.0r7-etch-amd64";
+      fullName = "Debian 4.0r7 Etch (amd64)";
       packagesList = fetchurl {
         url = mirror://debian/dists/etch/main/binary-amd64/Packages.bz2;
-        sha256 = "244dc892f89f2f73ce8372cdf1f1d450b00c0e95196927ef7f99715f0d119d5b";
+        sha256 = "3ab73a45781651a78c824b4f281de91b1aa6974d63470f40525933d848183e44";
+      };
+      urlPrefix = mirror://debian;
+    } // args);
+
+    debian50i386 = args: makeImageFromDebDist ({
+      name = "debian-5.0-lenny-i386";
+      fullName = "Debian 5.0 Lenny (i386)";
+      packagesList = fetchurl {
+        url = mirror://debian/dists/lenny/main/binary-i386/Packages.bz2;
+        sha256 = "afbead64fb4820e50294686cd3ccdff91026b214aabec3f212f9001482001061";
+      };
+      urlPrefix = mirror://debian;
+    } // args);
+        
+    debian50x86_64 = args: makeImageFromDebDist ({
+      name = "debian-5.0-lenny-amd64";
+      fullName = "Debian 5.0 Lenny (amd64)";
+      packagesList = fetchurl {
+        url = mirror://debian/dists/lenny/main/binary-amd64/Packages.bz2;
+        sha256 = "73d74454d687dfbdfef1abbe4bd9c251119f38ab8d371a593aa271bfa227ed2b";
       };
       urlPrefix = mirror://debian;
     } // args);
@@ -856,7 +905,6 @@ rec {
     "automake"
     "bzip2"
     "curl"
-    "devs"
     "diffutils"
     "findutils"
     "gawk"
@@ -896,6 +944,11 @@ rec {
     "util-linux" 
     "file"
     "dpkg-dev"
+    # Needed because it provides /etc/login.defs, whose absence causes
+    # the "passwd" post-installs script to fail.
+    "login"
+    # For shutting up some messages during some post-install scripts:
+    "mktemp"
   ];
 
 
@@ -939,7 +992,9 @@ rec {
     fedora9x86_64 = diskImageFuns.fedora9x86_64 { packages = commonFedoraPackages; };
     fedora10i386 = diskImageFuns.fedora10i386 { packages = commonFedoraPackages; };
     fedora10x86_64 = diskImageFuns.fedora10x86_64 { packages = commonFedoraPackages; };
-    opensuse103i386 = diskImageFuns.opensuse103i386 { packages = commonOpenSUSEPackages; };
+    opensuse103i386 = diskImageFuns.opensuse103i386 { packages = commonOpenSUSEPackages ++ ["devs"]; };
+    opensuse110i386 = diskImageFuns.opensuse110i386 { packages = commonOpenSUSEPackages; };
+    opensuse110x86_64 = diskImageFuns.opensuse110x86_64 { packages = commonOpenSUSEPackages; };
     
     ubuntu710i386 = diskImageFuns.ubuntu710i386 { packages = commonDebianPackages; };
     ubuntu804i386 = diskImageFuns.ubuntu804i386 { packages = commonDebianPackages; };
@@ -948,6 +1003,8 @@ rec {
     ubuntu810x86_64 = diskImageFuns.ubuntu810x86_64 { packages = commonDebianPackages; };
     debian40i386 = diskImageFuns.debian40i386 { packages = commonDebianPackages; };
     debian40x86_64 = diskImageFuns.debian40x86_64 { packages = commonDebianPackages; };
+    debian50i386 = diskImageFuns.debian50i386 { packages = commonDebianPackages; };
+    debian50x86_64 = diskImageFuns.debian50x86_64 { packages = commonDebianPackages; };
 
   };
 
diff --git a/pkgs/build-support/vm/test.nix b/pkgs/build-support/vm/test.nix
index 064fabdd5002..c61469bf2262 100644
--- a/pkgs/build-support/vm/test.nix
+++ b/pkgs/build-support/vm/test.nix
@@ -23,7 +23,7 @@ rec {
   
   buildInDebian = runInLinuxImage (stdenv.mkDerivation {
     name = "deb-compile";
-    src = nixUnstable.src;
+    src = patchelf.src;
     diskImage = diskImages.ubuntu810i386;
     memSize = 512;
     phases = "sysInfoPhase unpackPhase patchPhase configurePhase buildPhase checkPhase installPhase fixupPhase distPhase";
diff --git a/pkgs/data/documentation/man-pages/default.nix b/pkgs/data/documentation/man-pages/default.nix
index c909cebb4b00..8adc7fb634bc 100644
--- a/pkgs/data/documentation/man-pages/default.nix
+++ b/pkgs/data/documentation/man-pages/default.nix
@@ -1,11 +1,11 @@
 {stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
-  name = "man-pages-3.15";
+  name = "man-pages-3.18";
   
   src = fetchurl {
     url = "mirror://kernel/linux/docs/man-pages/${name}.tar.bz2";
-    sha256 = "0pr29ziz2d2zl2iii16372x2bqvx1a5g8xbb6wga4nxiz4w6ixhh";
+    sha256 = "7be08777fae2c873106f6d3ae09678444e635112ad9c52f9e9200439710dd8de";
   };
 
   preBuild = "
diff --git a/pkgs/data/documentation/rnrs/common.nix b/pkgs/data/documentation/rnrs/common.nix
index 2775a36f3218..8053020a3f27 100644
--- a/pkgs/data/documentation/rnrs/common.nix
+++ b/pkgs/data/documentation/rnrs/common.nix
@@ -15,8 +15,7 @@ stdenv.mkDerivation rec {
   builder = ./builder.sh;
 
   meta = {
-    description = ''Revised^${toString revision} Report on the
-                    Algorithmic Language Scheme'';
+    description = "Revised^${toString revision} Report on the Algorithmic Language Scheme";
 
     longDescription = ''
       This package contains the GNU Info version of the
diff --git a/pkgs/data/fonts/clearlyU/1.9.nix b/pkgs/data/fonts/clearlyU/1.9.nix
index db5709bf0359..3ff5db2c60c6 100644
--- a/pkgs/data/fonts/clearlyU/1.9.nix
+++ b/pkgs/data/fonts/clearlyU/1.9.nix
@@ -23,9 +23,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[doInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		A Unicode font.
-";
+		description = "A Unicode font";
 		inherit src;
 	};
 }
diff --git a/pkgs/data/fonts/junicode/0.6.15.nix b/pkgs/data/fonts/junicode/0.6.15.nix
index 601b6671e95c..b31b04c0f5bf 100644
--- a/pkgs/data/fonts/junicode/0.6.15.nix
+++ b/pkgs/data/fonts/junicode/0.6.15.nix
@@ -21,9 +21,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[doInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		A Unicode font.
-";
+		description = "A Unicode font";
 		inherit src;
 	};
 }
diff --git a/pkgs/data/fonts/ucs-fonts/default.nix b/pkgs/data/fonts/ucs-fonts/default.nix
index aef45dcd96cf..13b95326b2f4 100644
--- a/pkgs/data/fonts/ucs-fonts/default.nix
+++ b/pkgs/data/fonts/ucs-fonts/default.nix
@@ -31,9 +31,7 @@ wrapFonts (stdenv.mkDerivation {
 	'';
 
 	meta = {
-		description = "
-			UCS-fonts - Unicode bitmap fonts.
-		";
+		description = "Unicode bitmap fonts";
 		src = [srcA srcB srcC];
 	};
 })
diff --git a/pkgs/data/fonts/wqy_zenhei/0.4.23-1.nix b/pkgs/data/fonts/wqy_zenhei/0.4.23-1.nix
index da520e968321..5d4866daf28e 100644
--- a/pkgs/data/fonts/wqy_zenhei/0.4.23-1.nix
+++ b/pkgs/data/fonts/wqy_zenhei/0.4.23-1.nix
@@ -20,9 +20,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[doInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		A (mainly) Chinese Unicode font.
-";
+		description = "A (mainly) Chinese Unicode font";
 		inherit src;
 	};
 }
diff --git a/pkgs/data/misc/poppler-data/default.nix b/pkgs/data/misc/poppler-data/default.nix
index eb1d530dc007..68e3e9a32e8f 100644
--- a/pkgs/data/misc/poppler-data/default.nix
+++ b/pkgs/data/misc/poppler-data/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv }:
 
 stdenv.mkDerivation rec {
-  name = "poppler-data-0.2.0";
+  name = "poppler-data-0.2.1";
 
   src = fetchurl {
     url = "http://poppler.freedesktop.org/${name}.tar.gz";
-    sha256 = "0cpa1krpd6xjbn1nv825z5p8v4cfcypdri4bhzvn2dnjy997x9k8";
+    sha256 = "0q56l5v89pnpkm1kqmwb1sx2zcx89q6bxz2hq2cpkq5f8kgvl3c9";
   };
 
   installFlags = "prefix=\${out}";
diff --git a/pkgs/data/misc/shared-mime-info/0.22.nix b/pkgs/data/misc/shared-mime-info/0.22.nix
deleted file mode 100644
index 399b3296d382..000000000000
--- a/pkgs/data/misc/shared-mime-info/0.22.nix
+++ /dev/null
@@ -1,2 +0,0 @@
-args:
-import ./common.nix "1chz63v9jr009z9jhs07klybmhyf58i8vxipigf5gkdabjiclcyr" args
diff --git a/pkgs/data/misc/shared-mime-info/0.23.nix b/pkgs/data/misc/shared-mime-info/0.23.nix
deleted file mode 100644
index 38617dfe8e3f..000000000000
--- a/pkgs/data/misc/shared-mime-info/0.23.nix
+++ /dev/null
@@ -1,2 +0,0 @@
-args:
-import ./common.nix "080ny2vy00202hxcm7xm72j1zmyfs15dbsnqipwni6b2dg2am3q3" args
diff --git a/pkgs/data/misc/shared-mime-info/common.nix b/pkgs/data/misc/shared-mime-info/common.nix
deleted file mode 100644
index 8c2ff363c6af..000000000000
--- a/pkgs/data/misc/shared-mime-info/common.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-hash: args: with args;
-
-stdenv.mkDerivation rec {
-  name = "shared-mime-info-" + version;
-
-  src = fetchurl {
-    url = "http://freedesktop.org/~hadess/${name}.tar.bz2";
-    sha256 = hash;
-  };
-
-  buildInputs = [perl perlXMLParser pkgconfig gettext libxml2 glib];
-
-  meta = {
-    homepage = http://freedesktop.org/wiki/Software/shared-mime-info;
-  };
-}
diff --git a/pkgs/data/misc/shared-mime-info/default.nix b/pkgs/data/misc/shared-mime-info/default.nix
new file mode 100644
index 000000000000..b151570c7f11
--- /dev/null
+++ b/pkgs/data/misc/shared-mime-info/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl, pkgconfig, gettext, intltool, libxml2, glib}:
+
+stdenv.mkDerivation rec {
+  name = "shared-mime-info-0.51";
+
+  src = fetchurl {
+    url = "http://freedesktop.org/~hadess/${name}.tar.bz2";
+    sha256 = "1n7fn3vnqdq5c4xjyflwryxdb75cwsmw39hdpjy90swd841pw90w";
+  };
+
+  buildInputs = [pkgconfig gettext intltool libxml2 glib];
+
+  meta = {
+    description = "A database of common MIME types";
+    homepage = http://freedesktop.org/wiki/Software/shared-mime-info;
+  };
+}
diff --git a/pkgs/desktops/kde-3/kdebase/default.nix b/pkgs/desktops/kde-3/kdebase/default.nix
new file mode 100644
index 000000000000..814d46291571
--- /dev/null
+++ b/pkgs/desktops/kde-3/kdebase/default.nix
@@ -0,0 +1,55 @@
+{ stdenv, fetchurl, pkgconfig, x11, xlibs, zlib, libpng, libjpeg, perl
+, qt, kdelibs, openssl, bzip2, fontconfig, pam, hal, dbus, glib
+}:
+
+# Note: the glib dependency is needed for nspluginviewer.
+
+let version = "3.5.10"; in
+
+stdenv.mkDerivation {
+  name = "kdebase-${version}";
+  
+  src = fetchurl {
+    url = "mirror://kde/stable/${version}/src/kdebase-${version}.tar.bz2";
+    sha256 = "0qbbw78b725kf35p5jx11zq0246zm15pyyhmlpkz4cn5527rvakp";
+  };
+
+  buildInputs = [
+    pkgconfig x11 zlib libpng libjpeg perl qt kdelibs openssl bzip2
+    fontconfig pam hal dbus glib
+    xlibs.libXrandr xlibs.libXinerama xlibs.libXau xlibs.libXdmcp
+    xlibs.libXcursor xlibs.libfontenc xlibs.imake xlibs.bdftopcf
+    xlibs.libxkbfile xlibs.xf86miscproto xlibs.libXxf86misc
+    xlibs.scrnsaverproto xlibs.libXScrnSaver
+    xlibs.libXcomposite xlibs.libXfixes
+  ];
+
+  configureFlags = ''
+    --without-arts 
+    --with-ssl-dir=${openssl}
+    --with-extra-includes=${libjpeg}/include
+  '';
+
+  # Prevent configure from looking for pkg-config and freetype-config
+  # in the wrong location (it looks in /usr/bin etc. *before* looking
+  # in $PATH).
+  preConfigure = ''
+    substituteInPlace configure \
+      --replace /usr/bin /no-such-path \
+      --replace /usr/local/bin /no-such-path \
+      --replace /opt/local/bin /no-such-path
+  '';
+
+  # Quick hack to work around a faulty dependency in
+  # konqueror/keditbookmarks/Makefile.am (${includedir} should be
+  # ${kdelibs} or so).
+  preBuild = ''
+    ensureDir $out/include
+    ln -s ${kdelibs}/include/kbookmarknotifier.h $out/include/
+  '';
+  
+  postInstall = "rm $out/include/kbookmarknotifier.h";
+
+  # Work around some inexplicable build failure starting in kdebase 3.5.9.
+  LDFLAGS = "-L${kdelibs}/lib";
+}
diff --git a/pkgs/desktops/kde-3/kdelibs/default.nix b/pkgs/desktops/kde-3/kdelibs/default.nix
new file mode 100644
index 000000000000..86a85ab042bb
--- /dev/null
+++ b/pkgs/desktops/kde-3/kdelibs/default.nix
@@ -0,0 +1,43 @@
+{ stdenv, fetchurl, xlibs, zlib, perl, qt, openssl, pcre
+, pkgconfig, libjpeg, libpng, libtiff, libxml2, libxslt, libtool, expat
+, freetype, bzip2, cups, attr, acl
+}:
+
+let version = "3.5.10"; in
+
+stdenv.mkDerivation {
+  name = "kdelibs-${version}";
+  
+  src = fetchurl {
+    url = "mirror://kde/stable/${version}/src/kdelibs-${version}.tar.bz2";
+    sha256 = "0wjw51r96h6rngbsrzndw890xggzvrakydsbaldlrvbh3jq9qzk1";
+  };
+
+  passthru = {inherit openssl libjpeg qt; inherit (xlibs) libX11;};
+  
+  buildInputs = [
+    zlib perl qt openssl pcre pkgconfig libjpeg libpng libtiff libxml2
+    libxslt expat libtool freetype bzip2 cups
+    xlibs.libX11 xlibs.libXt xlibs.libXext xlibs.libXrender xlibs.libXft
+  ];
+
+  propagatedBuildInputs = [attr acl];
+
+  # Prevent configure from looking for pkg-config and freetype-config
+  # in the wrong location (it looks in /usr/bin etc. *before* looking
+  # in $PATH).
+  preConfigure = ''
+    substituteInPlace configure \
+      --replace /usr/bin /no-such-path \
+      --replace /usr/local/bin /no-such-path \
+      --replace /opt/local/bin /no-such-path
+  '';
+
+  configureFlags = ''
+    --without-arts 
+    --with-ssl-dir=${openssl}
+    --with-extra-includes=${libjpeg}/include
+    --x-includes=${xlibs.libX11}/include
+    --x-libraries=${xlibs.libX11}/lib
+  '';
+}
diff --git a/pkgs/desktops/kde-4/base/builder.sh b/pkgs/desktops/kde-4-old/base/builder.sh
index 99b357fcf167..99b357fcf167 100755
--- a/pkgs/desktops/kde-4/base/builder.sh
+++ b/pkgs/desktops/kde-4-old/base/builder.sh
diff --git a/pkgs/desktops/kde-4/base/default.nix b/pkgs/desktops/kde-4-old/base/default.nix
index ea4ee603c025..ea4ee603c025 100644
--- a/pkgs/desktops/kde-4/base/default.nix
+++ b/pkgs/desktops/kde-4-old/base/default.nix
diff --git a/pkgs/desktops/kde-4/decibel/default.nix b/pkgs/desktops/kde-4-old/decibel/default.nix
index ff98b48ee6fc..ff98b48ee6fc 100644
--- a/pkgs/desktops/kde-4/decibel/default.nix
+++ b/pkgs/desktops/kde-4-old/decibel/default.nix
diff --git a/pkgs/desktops/kde-4/default.nix b/pkgs/desktops/kde-4-old/default.nix
index 9732d9e2b2b7..9732d9e2b2b7 100644
--- a/pkgs/desktops/kde-4/default.nix
+++ b/pkgs/desktops/kde-4-old/default.nix
diff --git a/pkgs/desktops/kde-4/edu/default.nix b/pkgs/desktops/kde-4-old/edu/default.nix
index 4ee00d765279..4ee00d765279 100644
--- a/pkgs/desktops/kde-4/edu/default.nix
+++ b/pkgs/desktops/kde-4-old/edu/default.nix
diff --git a/pkgs/desktops/kde-4/edu/myCmakeFiles/CheckBoostAndPythonCompatible.cmake b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/CheckBoostAndPythonCompatible.cmake
index 35701ecf5c68..35701ecf5c68 100644
--- a/pkgs/desktops/kde-4/edu/myCmakeFiles/CheckBoostAndPythonCompatible.cmake
+++ b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/CheckBoostAndPythonCompatible.cmake
diff --git a/pkgs/desktops/kde-4/edu/myCmakeFiles/FindBoostPython.cmake b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/FindBoostPython.cmake
index b68959d8a9c9..b68959d8a9c9 100644
--- a/pkgs/desktops/kde-4/edu/myCmakeFiles/FindBoostPython.cmake
+++ b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/FindBoostPython.cmake
diff --git a/pkgs/desktops/kde-4/edu/myCmakeFiles/FindLibfacile.cmake b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/FindLibfacile.cmake
index 154531dabc11..154531dabc11 100644
--- a/pkgs/desktops/kde-4/edu/myCmakeFiles/FindLibfacile.cmake
+++ b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/FindLibfacile.cmake
diff --git a/pkgs/desktops/kde-4/edu/myCmakeFiles/PythonLibsUtils.cmake b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/PythonLibsUtils.cmake
index df54324712a1..df54324712a1 100644
--- a/pkgs/desktops/kde-4/edu/myCmakeFiles/PythonLibsUtils.cmake
+++ b/pkgs/desktops/kde-4-old/edu/myCmakeFiles/PythonLibsUtils.cmake
diff --git a/pkgs/desktops/kde-4/extragear/default.nix b/pkgs/desktops/kde-4-old/extragear/default.nix
index c67d4b8682cb..c67d4b8682cb 100644
--- a/pkgs/desktops/kde-4/extragear/default.nix
+++ b/pkgs/desktops/kde-4-old/extragear/default.nix
diff --git a/pkgs/desktops/kde-4/games/default.nix b/pkgs/desktops/kde-4-old/games/default.nix
index 4c3c1c115f0f..4c3c1c115f0f 100644
--- a/pkgs/desktops/kde-4/games/default.nix
+++ b/pkgs/desktops/kde-4-old/games/default.nix
diff --git a/pkgs/desktops/kde-4/graphics/default.nix b/pkgs/desktops/kde-4-old/graphics/default.nix
index e67551fddb7f..e67551fddb7f 100644
--- a/pkgs/desktops/kde-4/graphics/default.nix
+++ b/pkgs/desktops/kde-4-old/graphics/default.nix
diff --git a/pkgs/desktops/kde-4/libs/FindIlmBase.cmake b/pkgs/desktops/kde-4-old/libs/FindIlmBase.cmake
index 1511e9509cee..1511e9509cee 100644
--- a/pkgs/desktops/kde-4/libs/FindIlmBase.cmake
+++ b/pkgs/desktops/kde-4-old/libs/FindIlmBase.cmake
diff --git a/pkgs/desktops/kde-4/libs/FindOpenEXR.cmake b/pkgs/desktops/kde-4-old/libs/FindOpenEXR.cmake
index b1f590544fa8..b1f590544fa8 100644
--- a/pkgs/desktops/kde-4/libs/FindOpenEXR.cmake
+++ b/pkgs/desktops/kde-4-old/libs/FindOpenEXR.cmake
diff --git a/pkgs/desktops/kde-4/libs/default.nix b/pkgs/desktops/kde-4-old/libs/default.nix
index d0995429afe6..d0995429afe6 100644
--- a/pkgs/desktops/kde-4/libs/default.nix
+++ b/pkgs/desktops/kde-4-old/libs/default.nix
diff --git a/pkgs/desktops/kde-4/libs/setup.sh b/pkgs/desktops/kde-4-old/libs/setup.sh
index 6f899442d27a..6f899442d27a 100755
--- a/pkgs/desktops/kde-4/libs/setup.sh
+++ b/pkgs/desktops/kde-4-old/libs/setup.sh
diff --git a/pkgs/desktops/kde-4/multimedia/default.nix b/pkgs/desktops/kde-4-old/multimedia/default.nix
index c23439b5fc01..c23439b5fc01 100644
--- a/pkgs/desktops/kde-4/multimedia/default.nix
+++ b/pkgs/desktops/kde-4-old/multimedia/default.nix
diff --git a/pkgs/desktops/kde-4/network/default.nix b/pkgs/desktops/kde-4-old/network/default.nix
index f006c4c5921e..f006c4c5921e 100644
--- a/pkgs/desktops/kde-4/network/default.nix
+++ b/pkgs/desktops/kde-4-old/network/default.nix
diff --git a/pkgs/desktops/kde-4/pim/builder.sh b/pkgs/desktops/kde-4-old/pim/builder.sh
index 8963fae048ca..8963fae048ca 100755
--- a/pkgs/desktops/kde-4/pim/builder.sh
+++ b/pkgs/desktops/kde-4-old/pim/builder.sh
diff --git a/pkgs/desktops/kde-4/pim/default.nix b/pkgs/desktops/kde-4-old/pim/default.nix
index f0f4184d391f..f0f4184d391f 100644
--- a/pkgs/desktops/kde-4/pim/default.nix
+++ b/pkgs/desktops/kde-4-old/pim/default.nix
diff --git a/pkgs/desktops/kde-4/pimlibs/default.nix b/pkgs/desktops/kde-4-old/pimlibs/default.nix
index 6a61374a774c..6a61374a774c 100644
--- a/pkgs/desktops/kde-4/pimlibs/default.nix
+++ b/pkgs/desktops/kde-4-old/pimlibs/default.nix
diff --git a/pkgs/desktops/kde-4/runtime/builder.sh b/pkgs/desktops/kde-4-old/runtime/builder.sh
index 99b357fcf167..99b357fcf167 100755
--- a/pkgs/desktops/kde-4/runtime/builder.sh
+++ b/pkgs/desktops/kde-4-old/runtime/builder.sh
diff --git a/pkgs/desktops/kde-4/runtime/default.nix b/pkgs/desktops/kde-4-old/runtime/default.nix
index 8e31bce32fdb..8e31bce32fdb 100644
--- a/pkgs/desktops/kde-4/runtime/default.nix
+++ b/pkgs/desktops/kde-4-old/runtime/default.nix
diff --git a/pkgs/desktops/kde-4/support/akode.nix b/pkgs/desktops/kde-4-old/support/akode.nix
index 8fdf6736572e..8fdf6736572e 100644
--- a/pkgs/desktops/kde-4/support/akode.nix
+++ b/pkgs/desktops/kde-4-old/support/akode.nix
diff --git a/pkgs/desktops/kde-4/support/default.nix b/pkgs/desktops/kde-4-old/support/default.nix
index 426a5811bd79..426a5811bd79 100644
--- a/pkgs/desktops/kde-4/support/default.nix
+++ b/pkgs/desktops/kde-4-old/support/default.nix
diff --git a/pkgs/desktops/kde-4/support/eigen.nix b/pkgs/desktops/kde-4-old/support/eigen.nix
index 163683a29215..163683a29215 100644
--- a/pkgs/desktops/kde-4/support/eigen.nix
+++ b/pkgs/desktops/kde-4-old/support/eigen.nix
diff --git a/pkgs/desktops/kde-4/support/gmm.nix b/pkgs/desktops/kde-4-old/support/gmm.nix
index 843f9f6aaed5..843f9f6aaed5 100644
--- a/pkgs/desktops/kde-4/support/gmm.nix
+++ b/pkgs/desktops/kde-4-old/support/gmm.nix
diff --git a/pkgs/desktops/kde-4/support/qca.nix b/pkgs/desktops/kde-4-old/support/qca.nix
index fda435c7bffe..fda435c7bffe 100644
--- a/pkgs/desktops/kde-4/support/qca.nix
+++ b/pkgs/desktops/kde-4-old/support/qca.nix
diff --git a/pkgs/desktops/kde-4/support/qimageblitz.nix b/pkgs/desktops/kde-4-old/support/qimageblitz.nix
index 3364b4eac5da..3364b4eac5da 100644
--- a/pkgs/desktops/kde-4/support/qimageblitz.nix
+++ b/pkgs/desktops/kde-4-old/support/qimageblitz.nix
diff --git a/pkgs/desktops/kde-4/support/soprano.nix b/pkgs/desktops/kde-4-old/support/soprano.nix
index 0cb490b9db7e..0cb490b9db7e 100644
--- a/pkgs/desktops/kde-4/support/soprano.nix
+++ b/pkgs/desktops/kde-4-old/support/soprano.nix
diff --git a/pkgs/desktops/kde-4/support/strigi.nix b/pkgs/desktops/kde-4-old/support/strigi.nix
index d1ec98ea25f9..d1ec98ea25f9 100644
--- a/pkgs/desktops/kde-4/support/strigi.nix
+++ b/pkgs/desktops/kde-4-old/support/strigi.nix
diff --git a/pkgs/desktops/kde-4/support/taglib.nix b/pkgs/desktops/kde-4-old/support/taglib.nix
index 9a2acc96636b..9a2acc96636b 100644
--- a/pkgs/desktops/kde-4/support/taglib.nix
+++ b/pkgs/desktops/kde-4-old/support/taglib.nix
diff --git a/pkgs/desktops/kde-4/toys/default.nix b/pkgs/desktops/kde-4-old/toys/default.nix
index b88afded4113..b88afded4113 100644
--- a/pkgs/desktops/kde-4/toys/default.nix
+++ b/pkgs/desktops/kde-4-old/toys/default.nix
diff --git a/pkgs/desktops/kde-4/utils/default.nix b/pkgs/desktops/kde-4-old/utils/default.nix
index 4372bac8758c..4372bac8758c 100644
--- a/pkgs/desktops/kde-4/utils/default.nix
+++ b/pkgs/desktops/kde-4-old/utils/default.nix
diff --git a/pkgs/desktops/kde-4/workspace/builder.sh b/pkgs/desktops/kde-4-old/workspace/builder.sh
index 648d6175f35a..648d6175f35a 100755
--- a/pkgs/desktops/kde-4/workspace/builder.sh
+++ b/pkgs/desktops/kde-4-old/workspace/builder.sh
diff --git a/pkgs/desktops/kde-4/workspace/default.nix b/pkgs/desktops/kde-4-old/workspace/default.nix
index 041cd8977653..041cd8977653 100644
--- a/pkgs/desktops/kde-4/workspace/default.nix
+++ b/pkgs/desktops/kde-4-old/workspace/default.nix
diff --git a/pkgs/desktops/kde-4.2/admin/builder.sh b/pkgs/desktops/kde-4.2/admin/builder.sh
new file mode 100644
index 000000000000..09cb930f0498
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/admin/builder.sh
@@ -0,0 +1,13 @@
+source $stdenv/setup
+
+myPatchPhase()
+{
+    for i in system-config-printer-kde/cmake-modules/FindSystemConfigPrinter.py system-config-printer-kde/system-config-printer-kde.py
+    do
+	sed -i -e "s|/usr/share/system-config-printer|$system_config_printer/share/system-config-printer|" $i
+    done
+    
+    sed -i -e "s|import cupshelpers.ppds, cupshelpers.cupshelpers|import ppds, cupshelpers|" system-config-printer-kde/cmake-modules/FindSystemConfigPrinter.py
+}
+patchPhase=myPatchPhase
+genericBuild
diff --git a/pkgs/desktops/kde-4.2/admin/default.nix b/pkgs/desktops/kde-4.2/admin/default.nix
new file mode 100644
index 000000000000..a741525b0710
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/admin/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl, cmake, qt4, pkgconfig, perl, python,
+ sip, pyqt4, pycups, system_config_printer, rhpl,
+ kdelibs, kdepimlibs, kdebindings, automoc4, phonon}:
+
+stdenv.mkDerivation {
+  name = "kdeadmin-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdeadmin-4.2.1.tar.bz2;
+    sha1 = "888203103fe86010461b1e38d51ba9a20f3250e8";
+  };
+  builder = ./builder.sh;
+  inherit system_config_printer;
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  buildInputs = [ cmake qt4 pkgconfig perl python sip pyqt4 pycups system_config_printer rhpl
+                  kdelibs kdepimlibs kdebindings automoc4 phonon ];
+}
diff --git a/pkgs/desktops/kde-4.2/artwork/default.nix b/pkgs/desktops/kde-4.2/artwork/default.nix
new file mode 100644
index 000000000000..e1cc3f4b441d
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/artwork/default.nix
@@ -0,0 +1,12 @@
+{stdenv, fetchurl, cmake, qt4, perl, xscreensaver,
+ kdelibs, kdebase_workspace, automoc4, phonon, strigi, eigen}:
+
+stdenv.mkDerivation {
+  name = "kdeartwork-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdeartwork-4.2.1.tar.bz2;
+    sha1 = "02bd99ca5cf303bdeb991b3e85b45dfc4e69e0bc";
+  };
+  buildInputs = [ cmake qt4 perl xscreensaver
+                  kdelibs kdebase_workspace automoc4 phonon strigi eigen ];
+}
diff --git a/pkgs/desktops/kde-4.2/base-runtime/default.nix b/pkgs/desktops/kde-4.2/base-runtime/default.nix
new file mode 100644
index 000000000000..5728b206c92a
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/base-runtime/default.nix
@@ -0,0 +1,13 @@
+{stdenv, fetchurl, cmake, perl, bzip2, qt4, alsaLib, xineLib, samba, kdelibs,
+ automoc4, phonon, strigi, soprano, cluceneCore}:
+
+stdenv.mkDerivation {
+  name = "kdebase-runtime-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdebase-runtime-4.2.1.tar.bz2;
+    sha1 = "e80d1882d36e4c9737e80fcb5080bc683403ddb5";
+  };
+/*  CLUCENE_HOME=cluceneCore;*/
+  buildInputs = [ cmake perl bzip2 qt4 alsaLib xineLib samba stdenv.gcc.libc kdelibs
+                  automoc4 phonon strigi soprano cluceneCore ];
+}
diff --git a/pkgs/desktops/kde-4.2/base-workspace/default.nix b/pkgs/desktops/kde-4.2/base-workspace/default.nix
new file mode 100644
index 000000000000..a73b8d3b7c59
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/base-workspace/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl, cmake, perl, python,
+ qt4, sip, pyqt4, kdelibs, kdepimlibs, kdebindings,
+ libXi, libXau, libXdmcp, libXtst, libXcomposite, libXdamage, libXScrnSaver,
+ lm_sensors, libxklavier, libusb, pthread_stubs, boost,
+ automoc4, phonon, strigi, soprano, qimageblitz}:
+
+stdenv.mkDerivation {
+  name = "kdebase-workspace-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdebase-workspace-4.2.1.tar.bz2;
+    sha1 = "412b8a6778d5c71a366c054b0136edae309bbef0";
+  };
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  buildInputs = [ cmake perl python qt4 /*sip pyqt4*/ kdelibs kdepimlibs /*kdebindings*/ pthread_stubs boost libusb stdenv.gcc.libc
+                  libXi libXau libXdmcp libXtst libXcomposite libXdamage libXScrnSaver
+                  lm_sensors libxklavier automoc4 phonon strigi soprano qimageblitz ];
+}
diff --git a/pkgs/desktops/kde-4.2/base/default.nix b/pkgs/desktops/kde-4.2/base/default.nix
new file mode 100644
index 000000000000..901145b5b48d
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/base/default.nix
@@ -0,0 +1,12 @@
+{stdenv, fetchurl, cmake, perl, qt4, kdelibs, pciutils, libraw1394,
+ automoc4, phonon, strigi, qimageblitz, soprano}:
+
+stdenv.mkDerivation {
+  name = "kdebase-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdebase-4.2.1.tar.bz2;
+    sha1 = "c500024294a7621d176d26bdabdd138d18ec827d";
+  };
+  buildInputs = [ cmake perl qt4 kdelibs pciutils stdenv.gcc.libc libraw1394
+                  automoc4 phonon strigi qimageblitz soprano ];
+}
diff --git a/pkgs/desktops/kde-4.2/bindings/builder.sh b/pkgs/desktops/kde-4.2/bindings/builder.sh
new file mode 100644
index 000000000000..e3f1df28b77c
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/bindings/builder.sh
@@ -0,0 +1,11 @@
+source $stdenv/setup
+
+tar xfvj $src
+cd kdebindings-*/python/pykde4
+python configure.py -d $out/lib/python2.5/site-packages -v $out/share/sip
+for i in `find . -name Makefile`
+do
+    sed -i -e "s/-O2/-O0/" $i
+done
+make
+make install
diff --git a/pkgs/desktops/kde-4.2/bindings/default.nix b/pkgs/desktops/kde-4.2/bindings/default.nix
new file mode 100644
index 000000000000..712f321bef25
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/bindings/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl, python, sip, pyqt4, zlib, libpng, freetype, fontconfig, qt4,
+ libSM, libXrender, libXrandr, libXfixes, libXinerama, libXcursor, libXext, kdelibs}:
+
+# This function will only build the pykde4 module. I don't need the other bindings and
+# some bindings are even broken.
+
+stdenv.mkDerivation {
+  name = "kdebindings-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdebindings-4.2.1.tar.bz2;
+    sha1 = "96353bb3269a7ca37ff31487a0fb7a9c25958963";
+  };
+  builder = ./builder.sh;
+  buildInputs = [ python sip pyqt4 zlib libpng freetype fontconfig qt4
+                  libSM libXrender libXrandr libXfixes libXcursor libXinerama libXext kdelibs ];
+}
diff --git a/pkgs/desktops/kde-4.2/default.nix b/pkgs/desktops/kde-4.2/default.nix
index 0376b4006c43..364c5a28a8bd 100644
--- a/pkgs/desktops/kde-4.2/default.nix
+++ b/pkgs/desktops/kde-4.2/default.nix
@@ -24,8 +24,156 @@ rec {
     inherit (pkgs) qt4 jdk cluceneCore redland;
   };
   
+  qimageblitz = import ./support/qimageblitz {
+    inherit (pkgs) stdenv fetchurl cmake qt4;
+  };
+  
+  qca2 = import ./support/qca2 {
+    inherit (pkgs) stdenv fetchurl which qt4;
+  };
+  
+  akonadi = import ./support/akonadi {
+    inherit (pkgs) stdenv fetchurl cmake qt4 shared_mime_info libxslt boost mysql;
+    inherit automoc4;
+  };
+  
+  decibel = import ./support/decibel {
+    inherit (pkgs) stdenv fetchurl cmake qt4 tapioca_qt telepathy_qt dbus;
+  };
+  
+  eigen = import ./support/eigen {
+    inherit (pkgs) stdenv fetchurl cmake;
+  };
+  
 ### LIBS
-  kdelibs = import ./libs (pkgs // {
+  kdelibs = import ./libs {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl bzip2 pcre fam libxml2 libxslt;
+    inherit (pkgs) giflib jasper openexr aspell avahi shared_mime_info;
+    inherit automoc4 phonon strigi soprano;
+  };
+
+### BASE  
+  kdebase_workspace = import ./base-workspace {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl python sip pyqt4;
+    inherit (pkgs) lm_sensors libxklavier libusb pthread_stubs boost;
+    inherit (pkgs.xlibs) libXi libXau libXdmcp libXtst libXcomposite libXdamage libXScrnSaver;
+    inherit kdelibs kdepimlibs kdebindings;
+    inherit automoc4 phonon strigi soprano qimageblitz;
+  };
+  
+  kdebase = import ./base {
+    inherit (pkgs) stdenv fetchurl cmake perl qt4 pciutils libraw1394;
+    inherit kdelibs;
+    inherit automoc4 phonon strigi qimageblitz soprano;
+  };
+  
+  kdebase_runtime = import ./base-runtime {
+    inherit (pkgs) stdenv fetchurl cmake perl bzip2 qt4;
+    inherit (pkgs) xineLib alsaLib samba cluceneCore;
+    inherit kdelibs;
     inherit automoc4 phonon strigi soprano;
-  });
+  };
+
+### ADDITIONAL
+
+  kdepimlibs = import ./pimlibs {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl boost cyrus_sasl gpgme libical openldap;
+    inherit kdelibs;
+    inherit automoc4 phonon akonadi;
+  };
+  
+  kdeadmin = import ./admin {
+    inherit (pkgs) stdenv fetchurl cmake qt4 pkgconfig perl python sip pyqt4 pycups system_config_printer rhpl;
+    inherit kdelibs kdepimlibs kdebindings;
+    inherit automoc4 phonon;
+  };
+  
+  kdeartwork = import ./artwork {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl xscreensaver;
+    inherit kdelibs kdebase_workspace;
+    inherit automoc4 phonon strigi eigen;
+  };
+  
+  kdeedu = import ./edu {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl libxml2 libxslt openbabel boost;
+    inherit (pkgs) readline gmm gsl facile ocaml;
+    inherit kdelibs;
+    inherit automoc4 phonon;
+  };
+  
+  kdegraphics = import ./graphics {
+    inherit (pkgs) stdenv fetchurl cmake perl qt4 exiv2 lcms saneBackends libgphoto2;
+    inherit (pkgs) libspectre djvulibre chmlib;
+    inherit (pkgs.xlibs) libXxf86vm;
+    poppler = pkgs.popplerQt4;
+    inherit kdelibs;
+    inherit automoc4 phonon strigi qimageblitz soprano qca2;
+  };
+  
+  kdemultimedia = import ./multimedia {
+    inherit (pkgs) stdenv fetchurl cmake perl qt4;
+    inherit (pkgs) alsaLib xineLib libvorbis flac taglib cdparanoia;
+    inherit kdelibs;
+    inherit automoc4 phonon;
+  };
+  
+  kdenetwork = import ./network {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl gmp speex libxml2 libxslt sqlite alsaLib;
+    inherit (pkgs) libidn libvncserver tapioca_qt libmsn;
+    inherit (pkgs.xlibs) libXtst libXdamage libXxf86vm;
+    inherit kdelibs kdepimlibs;
+    inherit automoc4 phonon qca2 soprano qimageblitz;
+  };
+  
+  kdepim = import ./pim {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl boost gpgme libassuan libgpgerror libxslt;
+    inherit (pkgs) shared_mime_info;
+    inherit (pkgs.xlibs) libXScrnSaver;
+    inherit kdelibs kdepimlibs;
+    inherit automoc4 phonon akonadi strigi soprano qca2;
+  };
+  
+  kdeplasma_addons = import ./plasma-addons {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl python shared_mime_info;
+    inherit kdelibs kdebase_workspace kdepimlibs kdegraphics;
+    inherit automoc4 phonon;
+  };
+  
+  kdegames = import ./games {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl;
+    inherit kdelibs;
+    inherit automoc4 phonon qca2;
+  };
+
+  kdetoys = import ./toys {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl;
+    inherit kdelibs kdebase_workspace;
+    inherit automoc4 phonon;
+  };
+    
+  kdeutils = import ./utils {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl python gmp libzip libarchive sip pyqt4 pycups system_config_printer rhpl;
+    inherit kdelibs kdepimlibs kdebindings;
+    inherit automoc4 phonon qimageblitz;
+  };
+  
+### DEVELOPMENT
+
+  kdebindings = import ./bindings {
+    inherit (pkgs) stdenv fetchurl python sip zlib libpng pyqt4 freetype fontconfig qt4;
+    inherit (pkgs.xlibs) libSM libXrender libXrandr libXfixes libXcursor libXinerama libXext;
+    inherit kdelibs;
+  };
+  
+  kdesdk = import ./sdk {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl libxml2 libxslt boost subversion apr aprutil;
+    inherit kdelibs kdepimlibs;
+    inherit automoc4 phonon strigi;
+  };
+  
+  kdewebdev = import ./webdev {
+    inherit (pkgs) stdenv fetchurl cmake qt4 perl libxml2 libxslt boost;
+    inherit kdelibs kdepimlibs;
+    inherit automoc4 phonon;
+  };
 }
diff --git a/pkgs/desktops/kde-4.2/edu/default.nix b/pkgs/desktops/kde-4.2/edu/default.nix
new file mode 100644
index 000000000000..5336ecccfb6f
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/edu/default.nix
@@ -0,0 +1,13 @@
+{stdenv, fetchurl, cmake, qt4, perl, libxml2, libxslt, openbabel, boost, readline, gmm, gsl,
+ facile, ocaml,
+ kdelibs, automoc4, phonon}:
+
+stdenv.mkDerivation {
+  name = "kdeedu-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdeedu-4.2.1.tar.bz2;
+    sha1 = "f2381f33f6586b950e925423d135b9e66b7bf428";
+  };
+  buildInputs = [ cmake qt4 perl libxml2 libxslt openbabel boost readline gmm gsl facile ocaml
+                  kdelibs automoc4 phonon ];
+}
diff --git a/pkgs/desktops/kde-4.2/games/default.nix b/pkgs/desktops/kde-4.2/games/default.nix
new file mode 100644
index 000000000000..cc099d9cb704
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/games/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, cmake, qt4, perl, kdelibs, automoc4, phonon, qca2}:
+
+stdenv.mkDerivation {
+  name = "kdegames-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdegames-4.2.1.tar.bz2;
+    sha1 = "dee8a0fece054bc3b6234fa088ca16b8f5f87795";
+  };
+  buildInputs = [ cmake qt4 perl kdelibs automoc4 phonon qca2 ];
+}
diff --git a/pkgs/desktops/kde-4.2/graphics/default.nix b/pkgs/desktops/kde-4.2/graphics/default.nix
new file mode 100644
index 000000000000..e468bded53ff
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/graphics/default.nix
@@ -0,0 +1,14 @@
+{stdenv, fetchurl, cmake, perl, qt4, exiv2, lcms, saneBackends, libgphoto2,
+ libspectre, poppler, djvulibre, chmlib, libXxf86vm,
+ kdelibs, automoc4, phonon, strigi, qimageblitz, soprano, qca2}:
+
+stdenv.mkDerivation {
+  name = "kdegraphics-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdegraphics-4.2.1.tar.bz2;
+    sha1 = "5c21e016c75a79a9499aac26ea1240d6024e700e";
+  };
+  buildInputs = [ cmake perl qt4 exiv2 lcms saneBackends libgphoto2 libspectre poppler chmlib
+                  stdenv.gcc.libc libXxf86vm
+                  kdelibs automoc4 phonon strigi qimageblitz soprano qca2 ];
+}
diff --git a/pkgs/desktops/kde-4.2/libs/default.nix b/pkgs/desktops/kde-4.2/libs/default.nix
index c6ef7fc47678..881ca1b4f853 100644
--- a/pkgs/desktops/kde-4.2/libs/default.nix
+++ b/pkgs/desktops/kde-4.2/libs/default.nix
@@ -1,20 +1,20 @@
 { stdenv, fetchurl, cmake, perl
 , qt4, bzip2, pcre, fam, libxml2, libxslt, shared_mime_info, giflib, jasper
 , openexr, aspell, avahi
-, automoc4, phonon, strigi, soprano, ...
+, automoc4, phonon, strigi, soprano
 }:
 
 stdenv.mkDerivation {
-  name = "kdelibs-4.2.0";
+  name = "kdelibs-4.2.1";
   
   src = fetchurl {
-    url = mirror://kde/stable/4.2.0/src/kdelibs-4.2.0.tar.bz2;
-    md5 = "2d830a922195fefe6e073111850247ac";
+    url = mirror://kde/stable/4.2.1/src/kdelibs-4.2.1.tar.bz2;
+    sha1 = "d2214b9864b64e4a8382a9f593d082c801c58571";
   };
   
   buildInputs = [
     cmake perl qt4 stdenv.gcc.libc bzip2 pcre fam libxml2 libxslt
-    shared_mime_info giflib jasper openexr aspell avahi
+    shared_mime_info giflib jasper /* openexr */ aspell avahi
     automoc4 phonon strigi soprano
   ];
 }
diff --git a/pkgs/desktops/kde-4.2/multimedia/default.nix b/pkgs/desktops/kde-4.2/multimedia/default.nix
new file mode 100644
index 000000000000..77f7164e82d9
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/multimedia/default.nix
@@ -0,0 +1,12 @@
+{stdenv, fetchurl, cmake, perl, qt4, alsaLib, libvorbis, xineLib, taglib, flac, cdparanoia,
+ kdelibs, automoc4, phonon}:
+
+stdenv.mkDerivation {
+  name = "kdemultimedia-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdemultimedia-4.2.1.tar.bz2;
+    sha1 = "5382c963fae0ca6528c326b73234525e170a5c2e";
+  };
+  buildInputs = [ cmake perl qt4 alsaLib libvorbis xineLib flac taglib cdparanoia
+                  kdelibs automoc4 phonon ];
+}
diff --git a/pkgs/desktops/kde-4.2/network/default.nix b/pkgs/desktops/kde-4.2/network/default.nix
new file mode 100644
index 000000000000..451b50ad69ec
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/network/default.nix
@@ -0,0 +1,17 @@
+{stdenv, fetchurl, cmake, qt4, perl, speex, gmp, libxml2, libxslt, sqlite, alsaLib, libidn,
+ libvncserver, tapioca_qt, libmsn,
+ libXtst, libXdamage, libXxf86vm,
+ kdelibs, kdepimlibs, automoc4, phonon, qca2, soprano, qimageblitz}:
+
+stdenv.mkDerivation {
+  name = "kdenetwork-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdenetwork-4.2.1.tar.bz2;
+    sha1 = "d6d730c167cd72d43904715014b2adc8f7d5bc1e";
+  };
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  buildInputs = [ cmake qt4 perl speex gmp libxml2 libxslt sqlite alsaLib libidn
+                  libvncserver tapioca_qt libmsn
+		  libXtst libXdamage libXxf86vm
+                  kdelibs kdepimlibs automoc4 phonon qca2 soprano qimageblitz ];
+}
diff --git a/pkgs/desktops/kde-4.2/pim/builder.sh b/pkgs/desktops/kde-4.2/pim/builder.sh
new file mode 100644
index 000000000000..acc357c8a94c
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/pim/builder.sh
@@ -0,0 +1,8 @@
+source $stdenv/setup
+
+myPatchPhase()
+{
+    find .. -name CMakeLists.txt | xargs sed -i -e "s@DESTINATION \${KDE4_DBUS_INTERFACES_DIR}@DESTINATION \${CMAKE_INSTALL_PREFIX}/share/dbus-1/interfaces/@"
+}
+patchPhase=myPatchPhase
+genericBuild
diff --git a/pkgs/desktops/kde-4.2/pim/default.nix b/pkgs/desktops/kde-4.2/pim/default.nix
new file mode 100644
index 000000000000..8f36dac341b3
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/pim/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl, cmake, qt4, perl, boost, gpgme, libassuan, libgpgerror, libxslt,
+ shared_mime_info, libXScrnSaver,
+ kdelibs, kdepimlibs, automoc4, phonon, akonadi, strigi, soprano, qca2}:
+
+stdenv.mkDerivation {
+  name = "kdepim-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdepim-4.2.1.tar.bz2;
+    sha1 = "be97f4d34eb19b08c30988e07a75c24d5ccad08c";
+  };
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  builder = ./builder.sh;  
+  buildInputs = [ cmake qt4 perl boost gpgme stdenv.gcc.libc libassuan libgpgerror libxslt
+                  shared_mime_info libXScrnSaver
+                  kdelibs kdepimlibs automoc4 phonon akonadi strigi soprano qca2 ];
+}
diff --git a/pkgs/desktops/kde-4.2/pimlibs/default.nix b/pkgs/desktops/kde-4.2/pimlibs/default.nix
new file mode 100644
index 000000000000..134e01aa00e0
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/pimlibs/default.nix
@@ -0,0 +1,12 @@
+{stdenv, fetchurl, cmake, qt4, perl, boost, cyrus_sasl, gpgme, libical, openldap,
+ kdelibs, automoc4, phonon, akonadi}:
+
+stdenv.mkDerivation {
+  name = "kdepimlibs-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdepimlibs-4.2.1.tar.bz2;
+    sha1 = "150228037fcd740fec0a490149cd1980ddb8fb57";
+  };
+  buildInputs = [ cmake qt4 perl boost cyrus_sasl gpgme stdenv.gcc.libc libical openldap
+                  kdelibs automoc4 phonon akonadi ];
+}
diff --git a/pkgs/desktops/kde-4.2/plasma-addons/builder.sh b/pkgs/desktops/kde-4.2/plasma-addons/builder.sh
new file mode 100644
index 000000000000..7e56e26e0534
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/plasma-addons/builder.sh
@@ -0,0 +1,9 @@
+source $stdenv/setup
+
+myPatchPhase()
+{
+    sed -i -e "s@\${DBUS_INTERFACES_INSTALL_DIR}@\$ENV{kdebase_workspace}/share/dbus-1/interfaces@" applets/lancelot/app/src/CMakeLists.txt
+}
+
+patchPhase=myPatchPhase
+genericBuild
diff --git a/pkgs/desktops/kde-4.2/plasma-addons/default.nix b/pkgs/desktops/kde-4.2/plasma-addons/default.nix
new file mode 100644
index 000000000000..ad9b16337723
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/plasma-addons/default.nix
@@ -0,0 +1,15 @@
+{stdenv, fetchurl, cmake, qt4, perl, python, shared_mime_info,
+ kdelibs, kdebase_workspace, kdepimlibs, kdegraphics, automoc4, phonon}:
+
+stdenv.mkDerivation {
+  name = "kdeplasma-addons-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdeplasma-addons-4.2.1.tar.bz2;
+    sha1 = "8e164a8e1476862392371f765372c2e168895d55";
+  };
+  inherit kdebase_workspace;
+  builder = ./builder.sh;
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  buildInputs = [ cmake qt4 perl python shared_mime_info
+                  kdelibs kdebase_workspace kdepimlibs kdegraphics automoc4 phonon ];
+}
diff --git a/pkgs/desktops/kde-4.2/sdk/builder.sh b/pkgs/desktops/kde-4.2/sdk/builder.sh
new file mode 100644
index 000000000000..a83d7d44c0d5
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/sdk/builder.sh
@@ -0,0 +1,8 @@
+source $stdenv/setup
+
+myPatchPhase()
+{
+    sed -i -e "s|\${SVN_INCLUDES}|\${SVN_INCLUDES} $aprutil/include/apr-1|" kioslave/svn/CMakeLists.txt
+}
+patchPhase=myPatchPhase
+genericBuild
diff --git a/pkgs/desktops/kde-4.2/sdk/default.nix b/pkgs/desktops/kde-4.2/sdk/default.nix
new file mode 100644
index 000000000000..353e5ccfe72c
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/sdk/default.nix
@@ -0,0 +1,15 @@
+{stdenv, fetchurl, cmake, qt4, perl, libxml2, libxslt, boost, subversion, apr, aprutil,
+ kdelibs, kdepimlibs, automoc4, phonon, strigi}:
+
+stdenv.mkDerivation {
+  name = "kdesdk-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdesdk-4.2.1.tar.bz2;
+    sha1 = "dca74527bcf6e5925ec58a74196e683cc68a259a";
+  };
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  builder=./builder.sh;
+  inherit aprutil;
+  buildInputs = [ cmake qt4 perl libxml2 libxslt boost subversion apr aprutil
+                  kdelibs kdepimlibs automoc4 phonon strigi ];
+}
diff --git a/pkgs/desktops/kde-4.2/support/akonadi/default.nix b/pkgs/desktops/kde-4.2/support/akonadi/default.nix
new file mode 100644
index 000000000000..8d9ba73cc57f
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/support/akonadi/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, cmake, qt4, shared_mime_info, libxslt, boost, mysql, automoc4}:
+
+stdenv.mkDerivation {
+  name = "akonadi-1.1.1";
+  src = fetchurl {
+    url = http://akonadi.omat.nl/akonadi-1.1.1.tar.bz2;
+    md5 = "2e98b42cec9ec4e60a2e3c096f1a3106";
+  };
+  buildInputs = [ cmake qt4 shared_mime_info libxslt boost mysql automoc4 ];
+}
diff --git a/pkgs/desktops/kde-4.2/support/decibel/default.nix b/pkgs/desktops/kde-4.2/support/decibel/default.nix
new file mode 100644
index 000000000000..dab71739f6a7
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/support/decibel/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, cmake, qt4, tapioca_qt, telepathy_qt}:
+
+stdenv.mkDerivation {
+  name = "decibel-0.5.0";
+  src = fetchurl {
+    url = http://decibel.kde.org/fileadmin/downloads/decibel/releases/decibel-0.5.0.tar.gz;
+    md5 = "7de299ace568c87a746388ad765228e5";
+  };
+  buildInputs = [ cmake qt4 tapioca_qt telepathy_qt ];
+}
diff --git a/pkgs/desktops/kde-4.2/support/eigen/default.nix b/pkgs/desktops/kde-4.2/support/eigen/default.nix
new file mode 100644
index 000000000000..8ad17db3e04c
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/support/eigen/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, cmake}:
+
+stdenv.mkDerivation {
+  name = "eigen-2.0.0";
+  src = fetchurl {
+    url = http://download.tuxfamily.org/eigen/eigen-2.0.0.tar.bz2;
+    md5 = "bedfe344498b926a4b5db17d2846dbb5";
+  };
+  buildInputs = [ cmake ];  
+}
diff --git a/pkgs/desktops/kde-4.2/support/phonon/default.nix b/pkgs/desktops/kde-4.2/support/phonon/default.nix
index 99b3403f992e..35bfd838db85 100644
--- a/pkgs/desktops/kde-4.2/support/phonon/default.nix
+++ b/pkgs/desktops/kde-4.2/support/phonon/default.nix
@@ -5,10 +5,10 @@ gst_all, xineLib,
 automoc4}:
 
 stdenv.mkDerivation {
-  name = "phonon-4.3.0";
+  name = "phonon-4.3.1";
   src = fetchurl {
-    url = mirror://kde/stable/phonon/4.3.0/phonon-4.3.0.tar.bz2;
-    md5 = "f851219ec1fb4eadc7904f053b6b498d";
+    url = mirror://kde/stable/4.2.1/src/phonon-4.3.1.tar.bz2;
+    sha1 = "f7537e5280d0a4cc1348975daa7a7e45d833d45c";
   };
   buildInputs = [ cmake
                   libXau libXdmcp
diff --git a/pkgs/desktops/kde-4.2/support/qca2/default.nix b/pkgs/desktops/kde-4.2/support/qca2/default.nix
new file mode 100644
index 000000000000..d54c3acd69fb
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/support/qca2/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, which, qt4}:
+
+stdenv.mkDerivation {
+  name = "qca-2.0.1";
+  src = fetchurl {
+    url = http://delta.affinix.com/download/qca/2.0/qca-2.0.1.tar.bz2;
+    md5 = "a0a87d0b3210e23f8c1713562282b7d6";
+  };
+  buildInputs = [ which qt4 ];
+}
diff --git a/pkgs/desktops/kde-4.2/support/qimageblitz/default.nix b/pkgs/desktops/kde-4.2/support/qimageblitz/default.nix
new file mode 100644
index 000000000000..8e3dd70e2806
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/support/qimageblitz/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, cmake, qt4}:
+
+stdenv.mkDerivation {
+  name = "qimageblitz-0.0.4";
+  src = fetchurl {
+    url = mirror://sourceforge/qimageblitz/qimageblitz-0.0.4.tar.bz2;
+    md5 = "cb87c7f1c0455e8984ee4830f1e749cf";
+  };
+  buildInputs = [ cmake qt4 ];
+}
diff --git a/pkgs/desktops/kde-4.2/support/soprano/default.nix b/pkgs/desktops/kde-4.2/support/soprano/default.nix
index 558c4fd66fb6..87bac0c90506 100644
--- a/pkgs/desktops/kde-4.2/support/soprano/default.nix
+++ b/pkgs/desktops/kde-4.2/support/soprano/default.nix
@@ -1,10 +1,10 @@
 {stdenv, fetchurl, cmake, qt4, jdk, cluceneCore, redland}:
 
 stdenv.mkDerivation {
-  name = "soprano-2.2.1";
+  name = "soprano-2.2.3";
   src = fetchurl {
-    url = mirror://sourceforge/soprano/soprano-2.2.1.tar.bz2;
-    md5 = "69688a71273e1e9389fc60e3085c695f";
+    url = mirror://sourceforge/soprano/soprano-2.2.3.tar.bz2;
+    md5 = "22c992a252144ae0a3a964ba2f6f1933";
   };
   JAVA_HOME=jdk;
   buildInputs = [ cmake qt4 jdk cluceneCore redland ];
diff --git a/pkgs/desktops/kde-4.2/toys/default.nix b/pkgs/desktops/kde-4.2/toys/default.nix
new file mode 100644
index 000000000000..e1a23ce16cb1
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/toys/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, cmake, qt4, perl, kdelibs, kdebase_workspace, automoc4, phonon}:
+
+stdenv.mkDerivation {
+  name = "kdetoys-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdetoys-4.2.1.tar.bz2;
+    sha1 = "46157a10a35d37e798faa8bb988ac1c3f2a51f07";
+  };
+  buildInputs = [ cmake qt4 perl kdelibs kdebase_workspace automoc4 phonon ];
+}
diff --git a/pkgs/desktops/kde-4.2/utils/builder.sh b/pkgs/desktops/kde-4.2/utils/builder.sh
new file mode 100644
index 000000000000..c1ec2b7e1cd8
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/utils/builder.sh
@@ -0,0 +1,13 @@
+source $stdenv/setup
+
+myPatchPhase()
+{
+    for i in printer-applet/cmake-modules/FindSystemConfigPrinter.py printer-applet/printer-applet.py
+    do
+	sed -i -e "s|/usr/share/system-config-printer|$system_config_printer/share/system-config-printer|" $i
+    done
+    
+    sed -i -e "s|import cupshelpers.ppds, cupshelpers.cupshelpers|import ppds, cupshelpers|" printer-applet/cmake-modules/FindSystemConfigPrinter.py
+}
+patchPhase=myPatchPhase
+genericBuild
diff --git a/pkgs/desktops/kde-4.2/utils/default.nix b/pkgs/desktops/kde-4.2/utils/default.nix
new file mode 100644
index 000000000000..a77c2feed9db
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/utils/default.nix
@@ -0,0 +1,15 @@
+{stdenv, fetchurl, cmake, qt4, perl, gmp, python, libzip, libarchive, sip, pyqt4, pycups, system_config_printer, rhpl,
+ kdelibs, kdepimlibs, kdebindings, automoc4, phonon, qimageblitz}:
+
+stdenv.mkDerivation {
+  name = "kdeutils-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdeutils-4.2.1.tar.bz2;
+    sha1 = "2f875d05584b25b928b38e1da2b04c073acefd35";
+  };
+  builder = ./builder.sh;
+  inherit system_config_printer;
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  buildInputs = [ cmake qt4 perl gmp python libzip libarchive sip pyqt4 pycups system_config_printer rhpl
+                  kdelibs kdepimlibs kdebindings automoc4 phonon qimageblitz ];
+}
diff --git a/pkgs/desktops/kde-4.2/webdev/default.nix b/pkgs/desktops/kde-4.2/webdev/default.nix
new file mode 100644
index 000000000000..9b06650a4028
--- /dev/null
+++ b/pkgs/desktops/kde-4.2/webdev/default.nix
@@ -0,0 +1,12 @@
+{stdenv, fetchurl, cmake, qt4, perl, libxml2, libxslt, boost,
+ kdelibs, kdepimlibs, automoc4, phonon}:
+
+stdenv.mkDerivation {
+  name = "kdewebdev-4.2.1";
+  src = fetchurl {
+    url = mirror://kde/stable/4.2.1/src/kdewebdev-4.2.1.tar.bz2;
+    sha1 = "438bef3bb32ce53a83c6f30f65fb49d4d4e7c76a";
+  };
+  CMAKE_PREFIX_PATH=kdepimlibs;
+  buildInputs = [ cmake qt4 perl libxml2 libxslt boost kdelibs kdepimlibs automoc4 phonon ];
+}
diff --git a/pkgs/development/compilers/fpc/binary.nix b/pkgs/development/compilers/fpc/binary.nix
index 99725b501c08..eb931b959cb6 100644
--- a/pkgs/development/compilers/fpc/binary.nix
+++ b/pkgs/development/compilers/fpc/binary.nix
@@ -1,17 +1,16 @@
 args: with args;
+
 stdenv.mkDerivation {
-  name = "fpc-2.0.4-binary";
+  name = "fpc-2.2.2-binary";
 
   src = fetchurl {
-		url = ftp://ftp.chg.ru/pub/lang/pascal/fpc/dist/i386-linux-2.0.4/fpc-2.0.4.i386-linux.tar;
-		sha256 = "0b2szv2anbf58h4i5mlph93afv9qdx6i0jqggba04d3anjbl9gfy";
-	};
+    url = ftp://ftp.chg.ru/pub/lang/pascal/fpc/dist/i386-linux-2.2.2/fpc-2.2.2.i386-linux.tar;
+    sha256 = "8c18f63b36a76eee673f96ca254c49c5a42bcf3e36279abe8774f961792449a5";
+  };
 
   builder = ./binary-builder.sh;
 
   meta = {
-    description = "
-	Free Pascal Compiler from a binary distribution.
-";
+    description = "Free Pascal Compiler from a binary distribution";
   };
 } 
diff --git a/pkgs/development/compilers/fpc/default.nix b/pkgs/development/compilers/fpc/default.nix
index 463907e0518e..6fa0f1327872 100644
--- a/pkgs/development/compilers/fpc/default.nix
+++ b/pkgs/development/compilers/fpc/default.nix
@@ -1,29 +1,37 @@
 args:
-if ((args ? startFPC) && (args.startFPC != null))
-	then 
+
+if args ? startFPC && args.startFPC != null then
+
 with args;
+
 stdenv.mkDerivation {
-  name = "fpc-2.2.0";
+  name = "fpc-2.2.2";
 
   src = fetchurl {
-		url = ftp://freepascal.stack.nl/pub/fpc/dist/source-2.2.0/fpcbuild-2.2.0.tar.gz;
-		sha256 = "0pvsdmimknkgy8jgdz9kd7w5bs9fy5ynrgswpk0ib6x0y26zxijm";
-	};
+    url = ftp://freepascal.stack.nl/pub/fpc/dist/source-2.2.2/fpcbuild-2.2.2.tar.gz;
+    sha256 = "0d73b119e029382052fc6615034c4b5ee3ec66fa6cc45648f1f07cfb2c1058f1";
+  };
 
   buildInputs = [startFPC gawk];
 
-  preConfigure = (if system == "i686-linux" || system == "x86_64-linux" then ''
-  	sed -e "s@'/lib/ld-linux[^']*'@'''@" -i fpcsrc/compiler/systems/t_linux.pas
-  '' else "");
+  preConfigure =
+    if system == "i686-linux" || system == "x86_64-linux" then ''
+      sed -e "s@'/lib/ld-linux[^']*'@'''@" -i fpcsrc/compiler/systems/t_linux.pas
+    '' else "";
+
+  makeFlags = "NOGDB=1";
 
   installFlags = "INSTALL_PREFIX=\${out}";
-  postInstall = "ln -fs $out/lib/fpc/*/ppc386 $out/bin;
-	mkdir -p $out/lib/fpc/etc/ ;
-	$out/lib/fpc/*/samplecfg $out/lib/fpc/2.2.0 $out/lib/fpc/etc/;";
+  
+  postInstall = ''
+    ln -fs $out/lib/fpc/*/ppc386 $out/bin
+    mkdir -p $out/lib/fpc/etc/
+    $out/lib/fpc/*/samplecfg $out/lib/fpc/2.2.0 $out/lib/fpc/etc/
+  '';
 
   meta = {
-    description = "
-	Free Pascal Compiler from a source distribution.
-";
+    description = "Free Pascal Compiler from a source distribution";
   };
-} else (import ./default.nix (args // {startFPC = (import ./binary.nix args);}))
+}
+
+else (import ./default.nix (args // {startFPC = (import ./binary.nix args);}))
diff --git a/pkgs/development/compilers/fpc/lazarus.nix b/pkgs/development/compilers/fpc/lazarus.nix
index d00e270b67bc..7186563eafc5 100644
--- a/pkgs/development/compilers/fpc/lazarus.nix
+++ b/pkgs/development/compilers/fpc/lazarus.nix
@@ -1,8 +1,8 @@
 args : with args; 
 rec {
   src = fetchurl {
-    url = http://downloads.sourceforge.net/lazarus/lazarus-0.9.24-0.tar.gz;
-    sha256 = "0kkj1yycdbyrsw6c34gm5ya7q3256p8ph8j5a23x3qy86gbch827";
+    url = http://downloads.sourceforge.net/lazarus/lazarus-0.9.26-0.tgz;
+    sha256 = "1pb6h35axdmg552pvazgi7jclkx93vssy08cbpa4jw3rij7drhnl";
   };
 
   buildInputs = [fpc gtk glib libXi inputproto 
@@ -31,7 +31,7 @@ rec {
     wrapProgram $out/bin/startlazarus --prefix NIX_LDFLAGS ' ' "'$NIX_LDFLAGS'"
   '') ["doMakeInstall" "minInit" "defEnsureDir"];
 
-  name = "lazarus-0.9.24-0";
+  name = "lazarus-0.9.26-0";
   meta = {
     description = "Lazarus graphical IDE for FreePascal language";
     homepage = http://www.lazarus.freepascal.org ;
diff --git a/pkgs/development/compilers/gcc-upc-4.0/default.nix b/pkgs/development/compilers/gcc-upc-4.0/default.nix
index ec3fe9054772..68ae49b152a1 100644
--- a/pkgs/development/compilers/gcc-upc-4.0/default.nix
+++ b/pkgs/development/compilers/gcc-upc-4.0/default.nix
@@ -52,8 +52,10 @@ stdenv.mkDerivation {
   meta = {
     homepage = http://www.intrepid.com/upc.html;
     license = "GPL/LGPL";
-    description = ''A GCC-based compiler for the Unified Parallel C (UPC)
-                    language, a distributed shared memory aware variant of
-		    C (see http://upc.gwu.edu/).'';
+    longDscription = ''
+      A GCC-based compiler for the Unified Parallel C (UPC) language,
+      a distributed shared memory aware variant of C (see
+      http://upc.gwu.edu/).
+    '';
   };
 }
diff --git a/pkgs/development/compilers/ghcs/default.nix b/pkgs/development/compilers/ghcs/default.nix
index 8865ce78d03b..1eeadd06f6a7 100644
--- a/pkgs/development/compilers/ghcs/default.nix
+++ b/pkgs/development/compilers/ghcs/default.nix
@@ -173,7 +173,7 @@ rec {
                     };
           };
         derivations = with lib; builtins.listToAttrs (lib.concatLists ( lib.mapRecordFlatten 
-                  ( n : attrs : let d = (toDerivation attrs); in [ (nv n d) (nv attrs.name d) ] ) pkgs ) );
+                  ( n : attrs : let d = (toDerivation attrs); in [ (nameValuePair n d) (nameValuePair attrs.name d) ] ) pkgs ) );
     }.derivations;
   });
 
diff --git a/pkgs/development/compilers/gprolog/default.nix b/pkgs/development/compilers/gprolog/default.nix
new file mode 100644
index 000000000000..d4d348f179ec
--- /dev/null
+++ b/pkgs/development/compilers/gprolog/default.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "gprolog-1.3.1";
+
+  src = fetchurl {
+    urls = [
+      "mirror://gnu/gprolog/${name}.tar.gz"
+      "http://www.gprolog.org/${name}.tar.gz"
+    ];
+    sha256 = "05n3k0yynzvpc1ir1nw5bwm6m3ail0a0r1vqdsh4fii3kndiacrw";
+  };
+
+  configurePhase = "cd src ;"
+    + "./configure --prefix=$out "
+    + "--with-install-dir=$out/share/${name} "
+    + "--with-examples-dir=$out/share/doc/${name}/examples "
+    + "--with-doc-dir=$out/share/doc/${name}";
+
+  doCheck = true;
+
+  postInstall = ''
+    ln -vs "$out/share/${name}/include" "$out/include"
+  '';
+
+  meta = {
+    homepage = http://www.gnu.org/software/gprolog/;
+
+    description = "GNU Prolog, a free Prolog compiler with constraint solving over finite domains";
+
+    longDescription = ''
+      GNU Prolog is a free Prolog compiler with constraint solving
+      over finite domains developed by Daniel Diaz.
+
+      GNU Prolog accepts Prolog+constraint programs and produces
+      native binaries (like gcc does from a C source).  The obtained
+      executable is then stand-alone.  The size of this executable can
+      be quite small since GNU Prolog can avoid to link the code of
+      most unused built-in predicates.  The performances of GNU Prolog
+      are very encouraging (comparable to commercial systems).
+
+      Beside the native-code compilation, GNU Prolog offers a
+      classical interactive interpreter (top-level) with a debugger.
+
+      The Prolog part conforms to the ISO standard for Prolog with
+      many extensions very useful in practice (global variables, OS
+      interface, sockets,...).
+
+      GNU Prolog also includes an efficient constraint solver over
+      Finite Domains (FD).  This opens contraint logic programming to
+      the user combining the power of constraint programming to the
+      declarativity of logic programming.
+    '';
+
+    license = "GPLv2+";
+  };
+}
diff --git a/pkgs/development/compilers/hugs/default.nix b/pkgs/development/compilers/hugs/default.nix
index c910d88ccb19..4f3bbc6294be 100644
--- a/pkgs/development/compilers/hugs/default.nix
+++ b/pkgs/development/compilers/hugs/default.nix
@@ -1,56 +1,54 @@
 args: with args;
 let edf = composableDerivation.edf;
     wwf = composableDerivation.wwf; in
-composableDerivation.composableDerivation {
-  initial = {
+composableDerivation.composableDerivation {} {
 
-    name="hugs98";
+  name="hugs98";
 
-    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";
+  };
+
+      #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"; };
 
-        #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;
     };
+
+  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/qi/9.1.nix b/pkgs/development/compilers/qi/9.1.nix
index da21abef29e9..a1c9670be84f 100644
--- a/pkgs/development/compilers/qi/9.1.nix
+++ b/pkgs/development/compilers/qi/9.1.nix
@@ -31,9 +31,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [allBuild doForceShare doPropagate]);
 	meta = {
-		description = "
-		Qi - next generation on top of Common Lisp.
-";
+		description = "Qi - next generation on top of Common Lisp";
 		inherit src;
 	};
 }
diff --git a/pkgs/development/compilers/roadsend/default.nix b/pkgs/development/compilers/roadsend/default.nix
index c6d2249c8947..e23179c12882 100644
--- a/pkgs/development/compilers/roadsend/default.nix
+++ b/pkgs/development/compilers/roadsend/default.nix
@@ -1,38 +1,36 @@
 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";
-    };
+composableDerivation.composableDerivation {} {
+  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";
+  };
 
 #    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 = {
-      description = "roadsend PHP -> C compiler";
-      homepage = http://www.roadsend.com;
-      # you can choose one of the following licenses: 
-      # Runtime license is LPGL 2.1
-      license = ["GPL2"];
-    };
+  # 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 = {
+    description = "roadsend PHP -> C compiler";
+    homepage = http://www.roadsend.com;
+    # you can choose one of the following licenses: 
+    # Runtime license is LPGL 2.1
+    license = ["GPL2"];
   };
 }
diff --git a/pkgs/development/guile-modules/guile-lib/default.nix b/pkgs/development/guile-modules/guile-lib/default.nix
index c96101ed5394..f94bc747811c 100644
--- a/pkgs/development/guile-modules/guile-lib/default.nix
+++ b/pkgs/development/guile-modules/guile-lib/default.nix
@@ -24,8 +24,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   meta = {
-    description = ''Guile-Library, a collection of useful Guile
-                    Scheme modules'';
+    description = "Guile-Library, a collection of useful Guile Scheme modules";
     homepage = http://home.gna.org/guile-lib/;
     license = "GPL";
   };
diff --git a/pkgs/development/interpreters/maude/default.nix b/pkgs/development/interpreters/maude/default.nix
index 59a51c5681c6..d53c02b31f69 100644
--- a/pkgs/development/interpreters/maude/default.nix
+++ b/pkgs/development/interpreters/maude/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   };
   fullMaude = fetchurl {
     url = "http://maude.cs.uiuc.edu/download/current/FM2.4/full-maude24.maude";
-    sha256 = "0fwpnp5a8vw7q3iczwlra9074is95a1087ikx0a0idy8p4drnl61";
+    sha256 = "9e4ebdc717dc968d0b6c1179f360e60b3a39ea8cecc1a7fa49f2105bbddc48c4";
   };
   docs = fetchurl {
     url = "http://mirror.switch.ch/mirror/gentoo/distfiles/maude-2.3.0-extras.tar.bz2";
diff --git a/pkgs/development/interpreters/php_configurable/default.nix b/pkgs/development/interpreters/php_configurable/default.nix
index 025e48a0a7b9..954cea1a4d41 100644
--- a/pkgs/development/interpreters/php_configurable/default.nix
+++ b/pkgs/development/interpreters/php_configurable/default.nix
@@ -4,177 +4,174 @@ args: with args;
 
 let inherit (args.composableDerivation) composableDerivation edf wwf; in
 
-composableDerivation {
-  initial = fixed : {
+composableDerivation {} ( fixed : {
 
-    name = "php_configurable-${version}";
+  name = "php_configurable-${version}";
 
-    buildInputs = ["flex" "bison" "pkgconfig"];
+  buildInputs = ["flex" "bison" "pkgconfig"];
 
-    flags = {
+  flags = {
 
 # much left to do here...
 
-      # SAPI modules:
-      
-        apxs2 = {
-          configureFlags = ["--with-apxs2=${apacheHttpd}/bin/apxs"];
-          buildInputs = [apacheHttpd];
-        };
-
-        # Extensions
+    # SAPI modules:
+    
+      apxs2 = {
+        configureFlags = ["--with-apxs2=${apacheHttpd}/bin/apxs"];
+        buildInputs = [apacheHttpd];
+      };
 
-        curl = {
-          configureFlags = ["--with-curl=${args.curl}" "--with-curlwrappers"];
-          buildInputs = [curl];
-        };
-        
-        zlib = {
-          configureFlags = ["--with-zlib=${args.zlib}"];
-          buildInputs = [zlib];
-        };
+      # Extensions
 
-        libxml2 = {
-          configureFlags = ["--with-libxml-dir=${libxml2}"];
-          buildInputs = [ libxml2 ];
-        };
-      
-        postgresql = {
-          configureFlags = ["--with-pgsql=${postgresql}"];
-          buildInputs = [ postgresql ];
-        };
+      curl = {
+        configureFlags = ["--with-curl=${args.curl}" "--with-curlwrappers"];
+        buildInputs = [curl];
+      };
       
-        mysql = {
-          configureFlags = ["--with-mysql=${mysql}"];
-          buildInputs = [ mysql ];
-        };
-
-        mysqli = {
-          configureFlags = ["--with-mysqli=${mysql}/bin/mysql_config"];
-          buildInputs = [ mysql];
-        };
+      zlib = {
+        configureFlags = ["--with-zlib=${args.zlib}"];
+        buildInputs = [zlib];
+      };
 
-        mysqli_embedded = {
-          configureFlags = ["--enable-embedded-mysqli"];
-          depends = "mysqli";
-          assertion = fixed.mysqliSupport;
-        };
+      libxml2 = {
+        configureFlags = ["--with-libxml-dir=${libxml2}"];
+        buildInputs = [ libxml2 ];
+      };
+    
+      postgresql = {
+        configureFlags = ["--with-pgsql=${postgresql}"];
+        buildInputs = [ postgresql ];
+      };
+    
+      mysql = {
+        configureFlags = ["--with-mysql=${mysql}"];
+        buildInputs = [ mysql ];
+      };
 
-        pdo_mysql = {
-          configureFlags = ["--with-pdo-mysql=${mysql}"];
-          buildInputs = [ mysql ];
-        };
-      
-        bcmath = {
-          configureFlags = ["--enable-bcmath"];
-        };
+      mysqli = {
+        configureFlags = ["--with-mysqli=${mysql}/bin/mysql_config"];
+        buildInputs = [ mysql];
+      };
 
-        gd = {
-          configureFlags = ["--with-gd=${args.gd}"];
-          buildInputs = [gd];
-        };
+      mysqli_embedded = {
+        configureFlags = ["--enable-embedded-mysqli"];
+        depends = "mysqli";
+        assertion = fixed.mysqliSupport;
+      };
 
-        sockets = {
-          configureFlags = ["--enable-sockets"];
-        };
+      pdo_mysql = {
+        configureFlags = ["--with-pdo-mysql=${mysql}"];
+        buildInputs = [ mysql ];
+      };
+    
+      bcmath = {
+        configureFlags = ["--enable-bcmath"];
+      };
 
-        openssl = {
-          configureFlags = ["--with-openssl=${args.openssl}"];
-          buildInputs = ["openssl"];
-        };
+      gd = {
+        configureFlags = ["--with-gd=${args.gd}"];
+        buildInputs = [gd];
+      };
 
-        mbstring = {
-          configureFlags = ["--enable-mbstring"];
-        };
+      sockets = {
+        configureFlags = ["--enable-sockets"];
+      };
 
-        /*
-           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";
-          };
-        };
+      openssl = {
+        configureFlags = ["--with-openssl=${args.openssl}"];
+        buildInputs = ["openssl"];
       };
 
-    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;
-      mbstringSupport = true;
-      gdSupport = true;
-    };
+      mbstring = {
+        configureFlags = ["--enable-mbstring"];
+      };
 
-    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  $configureFlags
-      echo configurePhase end
-    '';
-
-    installPhase = ''
-      unset installPhase; installPhase;
-      cp php.ini-recommended $iniFile
-
-      # 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;
-        cd xdebug*
-        phpize
-        ./configure --prefix=$out
-        make
-        ensureDir $out/lib; cp modules/xdebug.so $out/lib
-        cat >> $out/etc/php.ini << EOF
-          zend_extension="$out/lib/xdebug.so"
-          zend_extension_ts="$out/lib/xdebug.so"
-          zend_extension_debug="$out/lib/xdebug.so"
-          xdebug.remote_enable=true
-          xdebug.remote_host=127.0.0.1
-          xdebug.remote_port=9000
-          xdebug.remote_handler=dbgp
-          xdebug.profiler_enable=0
-          xdebug.profiler_output_dir="/tmp/xdebug"
-          xdebug.remote_mode=req
-          max_execution_time = 300
-          date.timezone = UTC
-    EOF
-      fi
-    '';
-
-    src = args.fetchurl {
-      url = "http://nl.php.net/get/php-${version}.tar.bz2/from/this/mirror";
-      md5 = "7380ffecebd95c6edb317ef861229ebd";
-      name = "php-${version}.tar.bz2";
+      /*
+         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";
+        };
+      };
     };
 
-    meta = {
-      description = "The PHP language runtime engine";
-      homepage = http://www.php.net/;
-      license = "PHP-3";
-    };
+  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;
+    mbstringSupport = true;
+    gdSupport = true;
+  };
 
-    patches = [./fix.patch];
+  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  $configureFlags
+    echo configurePhase end
+  '';
+
+  installPhase = ''
+    unset installPhase; installPhase;
+    cp php.ini-recommended $iniFile
+
+    # 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;
+      cd xdebug*
+      phpize
+      ./configure --prefix=$out
+      make
+      ensureDir $out/lib; cp modules/xdebug.so $out/lib
+      cat >> $out/etc/php.ini << EOF
+        zend_extension="$out/lib/xdebug.so"
+        zend_extension_ts="$out/lib/xdebug.so"
+        zend_extension_debug="$out/lib/xdebug.so"
+        xdebug.remote_enable=true
+        xdebug.remote_host=127.0.0.1
+        xdebug.remote_port=9000
+        xdebug.remote_handler=dbgp
+        xdebug.profiler_enable=0
+        xdebug.profiler_output_dir="/tmp/xdebug"
+        xdebug.remote_mode=req
+        max_execution_time = 300
+        date.timezone = UTC
+  EOF
+    fi
+  '';
+
+  src = args.fetchurl {
+    url = "http://nl.php.net/get/php-${version}.tar.bz2/from/this/mirror";
+    md5 = "7380ffecebd95c6edb317ef861229ebd";
+    name = "php-${version}.tar.bz2";
+  };
 
+  meta = {
+    description = "The PHP language runtime engine";
+    homepage = http://www.php.net/;
+    license = "PHP-3";
   };
 
-}
+  patches = [./fix.patch];
+
+})
diff --git a/pkgs/development/interpreters/python-new/2.5/default.nix b/pkgs/development/interpreters/python-new/2.5/default.nix
index 1c2f22f66bbc..1287c1e59461 100644
--- a/pkgs/development/interpreters/python-new/2.5/default.nix
+++ b/pkgs/development/interpreters/python-new/2.5/default.nix
@@ -33,7 +33,7 @@ in
     # python wiht all features enabled.
     # if you really need a stripped version we should add __overides
     # so that you can replace it the way it's done in all-packages.nix
-    pythonFull = t.pythonMinimal.passthru.fun {
+    pythonFull = t.pythonMinimal.merge {
      name = "python-${t.version}-full";
       cfg = {
         zlibSupport = true;
@@ -79,48 +79,46 @@ in
     # lib to verify it works
     # You can define { python25 { debugCmd = "DISPLAY=:0.0 pathtoxterm"; }
     # in your config for easier debugging..
-    pythonLibStub = composableDerivation {
-      initial = {
-          propagatedBuildInputs = [ t.pythonFull ]; # see [1]
-          postPhases = ["postAll"]; # using new name so that you dno't override this phase by accident
-          prePhases = ["defineValidatingEval"];
-          # ensure phases are run or a non zero exit status is caused (if there are any syntax errors such as eval "while")
-          defineValidatingEval = ''
-            eval(){
-              e="$(type eval | { read; while read line; do echo $line; done })"
-              unset eval;
-              local evalSucc="failure"
-              eval "evalSucc=ok;""$1"
-              eval "$e"
-              [ $evalSucc = "failure" ] && { echo "eval failed, snippet:"; echo "$1"; return 1; }
-            }
-          '';
-          postAll = ''
-            ensureDir $out/nix-support
-            echo "export NIX_PYTHON_SITES=\"$out:\$NIX_PYTHON_SITES\"" >> $out/nix-support/setup-hook 
-            # run check
-            if [ -n "$pyCheck" ]; then
-               ( . $out/nix-support/setup-hook
-                   mkdir $TMP/new-test; cd $TMP/new-test
-                   echo PYTHONPATH=$PYTHONPATH
-                   echo NIX_PYTHON_SITES=$NIX_PYTHON_SITES
-                   script="$(echo -e "import sys\nprint sys.path\npyCheck\nprint \"check ok\"")"
-                   script="''${script/pyCheck/$pyCheck}"
-                   echo "check script is"; echo "$script"
-                   echo "$script" | python || { ${ getConfig [t.versionAttr "debugCmd"] ":"} ; echo "pycheck failed"; exit 1; }
-               )
-             fi'';
-          passthru = {
-            libPython = t.version; # used to find all python libraries fitting this version (-> see name all below)
-          };
-          mergeAttrBy = {
-            pyCheck = x : y : "${x}\n${y}";
-          };
-      };
+    pythonLibStub = composableDerivation {} {
+        propagatedBuildInputs = [ t.pythonFull ]; # see [1]
+        postPhases = ["postAll"]; # using new name so that you dno't override this phase by accident
+        prePhases = ["defineValidatingEval"];
+        # ensure phases are run or a non zero exit status is caused (if there are any syntax errors such as eval "while")
+        defineValidatingEval = ''
+          eval(){
+            e="$(type eval | { read; while read line; do echo $line; done })"
+            unset eval;
+            local evalSucc="failure"
+            eval "evalSucc=ok;""$1"
+            eval "$e"
+            [ $evalSucc = "failure" ] && { echo "eval failed, snippet:"; echo "$1"; return 1; }
+          }
+        '';
+        postAll = ''
+          ensureDir $out/nix-support
+          echo "export NIX_PYTHON_SITES=\"$out:\$NIX_PYTHON_SITES\"" >> $out/nix-support/setup-hook 
+          # run check
+          if [ -n "$pyCheck" ]; then
+             ( . $out/nix-support/setup-hook
+                 mkdir $TMP/new-test; cd $TMP/new-test
+                 echo PYTHONPATH=$PYTHONPATH
+                 echo NIX_PYTHON_SITES=$NIX_PYTHON_SITES
+                 script="$(echo -e "import sys\nprint sys.path\npyCheck\nprint \"check ok\"")"
+                 script="''${script/pyCheck/$pyCheck}"
+                 echo "check script is"; echo "$script"
+                 echo "$script" | python || { ${ getConfig [t.versionAttr "debugCmd"] ":"} ; echo "pycheck failed"; exit 1; }
+             )
+           fi'';
+        passthru = {
+          libPython = t.version; # used to find all python libraries fitting this version (-> see name all below)
+        };
+        mergeAttrBy = {
+          pyCheck = x : y : "${x}\n${y}";
+        };
     };
 
     # same as pythonLibStub, but runs default python setup.py actions
-    pythonLibSetup = t.pythonLibStub.passthru.fun {
+    pythonLibSetup = t.pythonLibStub.merge {
       buildPhase = ''python setup.py $setupFlags build'';
       installPhase = ''python setup.py $setupFlags install --prefix=$out'';
       mergeAttrBy = {
@@ -130,8 +128,8 @@ in
 
     ### python libraries:
 
-    wxPythonBaseFun = (t.pythonLibSetup.passthru.funMerge (a :
-      let inherit (a.fixed) wxGTK version; in
+    wxPythonBaseFun = (t.pythonLibSetup.merge (a :
+      let inherit (a.fixed.passthru) wxGTK;  inherit (a.fixed) version; in
         {
           buildInputs = [p.pkgconfig wxGTK (wxGTK.gtk)];
           setupFlags=["WXPORT=gtk2 NO_HEADERS=1 BUILD_GLCANVAS=0 BUILD_OGL=0 UNICODE=1"];
@@ -144,7 +142,7 @@ in
             license="wxWinLL-3";
           };
         }
-    )).passthru.fun;
+    )).merge;
 
     wxPython26 = t.wxPythonBaseFun {
       version = "2.6.3.3";
@@ -166,7 +164,7 @@ in
     #};
 
     # couldn't download source
-    #foursuite = pythonLibSetup.passthru.fun {
+    #foursuite = pythonLibSetup.merge {
     #  version = "1.0.2";
     #  name = "4suite-${version}";
     #  src = fetchurl {
@@ -175,7 +173,7 @@ in
     #  };
     #};
 
-    #bsddb3 = t.pythonLibSetup.passthru.fun {
+    #bsddb3 = t.pythonLibSetup.merge {
     #  version = "1.0.2";
     #  name = "bsddb3-4.5.0";
     #  setupFlags = ["--berkeley-db=${p.db4}"];
@@ -197,8 +195,8 @@ in
   # patching pygtk to another */gtk2.0 directory to sys.path for each NIX_PYTHON_SITES.
   # If you install dozens of python packages this might be bloat.
   # So  I think the overhead of installing these packages into the same store path should be prefered.
-  pygtkBaseFun = (t.pythonLibStub.passthru.funMerge (a :
-    let inherit (a.fixed) glib gtk; in lib.mergeAttrsByFuncDefaults [
+  pygtkBaseFun = (t.pythonLibStub.merge (a :
+    let inherit (a.fixed.passthru) glib gtk; in lib.mergeAttrsByFuncDefaults [
     {
       unpackPhase = "true";
       configurePhase = "true";
@@ -312,9 +310,9 @@ in
   #  '';
   #};
 
-  pygtk212 = t.pygtkBaseFun.passthru.funMerge (a : {
+  pygtk212 = t.pygtkBaseFun.merge (a : {
     version = "2.12.1";
-    name = "pygobject-${a.fixed.pygobjectVersion}-and-pygtk-${a.fixed.version}";
+    name = "pygobject-${a.fixed.passthru.pygobjectVersion}-and-pygtk-${a.fixed.version}";
     pygtkSrc = fetchurl { 
       url = http://ftp.acc.umu.se/pub/GNOME/sources/pygtk/2.12/pygtk-2.12.1.tar.bz2;
       sha256 = "0gg13xgr7y9sppw8bdys042928nc66czn74g60333c4my95ys021";
@@ -326,7 +324,7 @@ in
     '';
   });
 
-  pycairo = t.pythonLibStub.passthru.fun {
+  pycairo = t.pythonLibStub.merge {
     name = "pycairo-1.8.0";
     buildInputs = [ p.pkgconfig p.cairo p.x11 ];
     src = fetchurl {
@@ -336,7 +334,7 @@ in
     pyCheck = "import cairo";
   };
 
-  gstPython = t.pythonLibStub.passthru.fun {
+  gstPython = t.pythonLibStub.merge {
     name = "gst-python-0.10.13";
     src = fetchurl {
       url = http://gstreamer.freedesktop.org/src/gst-python/gst-python-0.10.13.tar.gz;
@@ -377,7 +375,7 @@ in
     };
   };
 
-  pygoocanvas = t.pythonLibStub.passthru.fun {
+  pygoocanvas = t.pythonLibStub.merge {
     src = p.fetchurl {
       url = http://download.berlios.de/pygoocanvas/pygoocanvas-0.10.0.tar.gz;
       sha256 = "0pxznzdscbhvn8102vrqy3r1g6ss4sgs8wwy6y4c5g26rrp7l55d";
@@ -393,7 +391,7 @@ in
     };
   };
 
-#  zope = t.pythonLibStub.passthru.fun rec {
+#  zope = t.pythonLibStub.merge rec {
 #[> version = "3.3.1";
 #    version = "svn";
 #    name = "zope-${version}";
@@ -409,7 +407,7 @@ in
 #    pyCheck = "";
 #  };
 
-  setuptools = t.pythonLibSetup.passthru.fun {
+  setuptools = t.pythonLibSetup.merge {
     name = "setuptools-0.6c9";
     postUnpack = ''
       ensureDir $out/lib/python2.5/site-packages
@@ -429,7 +427,7 @@ in
     };
   };
 
-  zopeInterface = t.pythonLibSetup.passthru.fun rec {
+  zopeInterface = t.pythonLibSetup.merge rec {
     version = "3.3.0";
     name = "zope.interface-${version}";
     buildInputs = [ t.setuptools ];
@@ -440,7 +438,7 @@ in
     pyCheck = "from zope.interface import Interface, Attribute";
   };
 
-  dbusPython = t.pythonLibStub.passthru.fun rec {
+  dbusPython = t.pythonLibStub.merge rec {
     version = "0.83.0";
     name = "dbus-python-0.83.0";
     buildInputs = [ p.pkgconfig ];
@@ -457,7 +455,7 @@ in
     };
   };
 
-  pythonXlib = t.pythonLibSetup.passthru.fun {
+  pythonXlib = t.pythonLibSetup.merge {
     name = "python-xlib-0.14";
     src = fetchurl {
       url = http://puzzle.dl.sourceforge.net/sourceforge/python-xlib/python-xlib-0.14.tar.gz;
@@ -470,26 +468,52 @@ in
     };
   };
 
-  ### python applications
+  mechanize = t.pythonLibSetup.merge {
+    name = "mechanize-0.1.11";
+    buildInputs = [ t.setuptools ];
+    src = fetchurl {
+      url = http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.1.11.tar.gz;
+      sha256 = "1h62mwy4iz09jqz17nrb9j8y0djd500zdfqwrz9xmdwqzqwixkj2";
+    };
+    meta = {
+      description = "Stateful programmatic web browsing in Python, after Andy Lester's Perl module WWW::Mechanize";
+      homepage = http://wwwsearch.sourceforge.net/mechanize/;
+      license = ["BSD" "ZPL 2.1"];
+    };
+    pyCheck = "from mechanize import Browser";
+  };
 
-  pythonExStub = composableDerivation {
-    initial = {
-      buildInputs = [p.makeWrapper];
-      postPhases = ["wrapExecutables"];
-      propagatedBuildInputs = [ t.pythonFull ]; # see [1]
-
-      # adding $out to NIX_PYTHON_SITES because some of those executables seem to come with extra libs
-      wrapExecutables = ''
-        for prog in $out/bin/*; do
-        wrapProgram "$prog" \
-                     --set NIX_PYTHON_SITES "$NIX_PYTHON_SITES:$out" \
-                     --set PYTHONPATH "\$PYTHONPATH:$out"
-        done
-      '';
+  pexpect = t.pythonLibSetup.merge {
+    name = "pexpect-2.3";
+    src = fetchurl {
+      url = mirror://sourceforge/pexpect/pexpect-2.3.tar.gz;
+      sha256 = "0x8bfjjqygriry1iyygm5048ykl5qpbpzqfp6i8dhkslm3ryf5fk";
+    };
+    meta = {
+      description = "tcl expect as python library";
+      homepage = http://www.noah.org/wiki/Pexpect;
+      license = "MIT";
     };
   };
 
-  pitivi = t.pythonExStub.passthru.fun {
+  ### python applications
+
+  pythonExStub = composableDerivation {} {
+    buildInputs = [p.makeWrapper];
+    postPhases = ["wrapExecutables"];
+    propagatedBuildInputs = [ t.pythonFull ]; # see [1]
+
+    # adding $out to NIX_PYTHON_SITES because some of those executables seem to come with extra libs
+    wrapExecutables = ''
+      for prog in $out/bin/*; do
+      wrapProgram "$prog" \
+                   --set NIX_PYTHON_SITES "$NIX_PYTHON_SITES:$out" \
+                   --set PYTHONPATH "\$PYTHONPATH:$out"
+      done
+    '';
+  };
+
+  pitivi = t.pythonExStub.merge {
     name = "pitivi-0.11.2";
     src = fetchurl {
       url = http://ftp.gnome.org/pub/GNOME/sources/pitivi/0.11/pitivi-0.11.2.tar.bz2;
@@ -509,7 +533,7 @@ in
     '';
   };
 
-  istanbul = t.pythonExStub.passthru.fun {
+  istanbul = t.pythonExStub.merge {
     name = "istanbul-0.2.2";
     buildInputs = [ t.pygtk212 t.gstPython /*t.gnomePython (contained in gtk) t.gnomePythonExtras */ t.pythonXlib
       p.perl p.perlXMLParser p.gettext];
diff --git a/pkgs/development/interpreters/python-new/2.5/python.nix b/pkgs/development/interpreters/python-new/2.5/python.nix
index 6ae5ffb68228..932d29b40848 100644
--- a/pkgs/development/interpreters/python-new/2.5/python.nix
+++ b/pkgs/development/interpreters/python-new/2.5/python.nix
@@ -2,11 +2,11 @@ args: with args;
 let inherit (lib) optional prepareDerivationArgs concatStringsSep fix;  in
 
 composableDerivation {
-  f = args: let attr = lib.prepareDerivationArgs args; in stdenv.mkDerivation ( attr // {
+  mkDerivation = attr : stdenv.mkDerivation ( attr // {
       C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p}/include") attr.buildInputs);
       LIBRARY_PATH = concatStringsSep ":" (map (p: "${p}/lib") attr.buildInputs);
     });
-  initial = {
+  } {
 
     postPhases = ["runCheck"];
 
@@ -65,5 +65,4 @@ composableDerivation {
       rm -rf $out/lib/python2.5/test
     ";
 
-  };
-}
+  }
diff --git a/pkgs/development/libraries/ConsoleKit/default.nix b/pkgs/development/libraries/ConsoleKit/default.nix
new file mode 100644
index 000000000000..743b3c1756cf
--- /dev/null
+++ b/pkgs/development/libraries/ConsoleKit/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, pkgconfig, dbus_glib, zlib, glib, libX11}:
+
+stdenv.mkDerivation {
+  name = "ConsoleKit-0.3.0";
+  src = fetchurl {
+    url = http://people.freedesktop.org/~mccann/dist/ConsoleKit-0.3.0.tar.bz2;
+    md5 = "43b02a52212330b54cfb34c4044d9ce0";    
+  };
+  buildInputs = [ pkgconfig dbus_glib zlib glib libX11 ];
+}
diff --git a/pkgs/development/libraries/SDL_image/default.nix b/pkgs/development/libraries/SDL_image/default.nix
index d26213ef7cd7..35154e9f945e 100644
--- a/pkgs/development/libraries/SDL_image/default.nix
+++ b/pkgs/development/libraries/SDL_image/default.nix
@@ -1,5 +1,6 @@
 args: with args;
-stdenv.mkDerivation (rec {
+
+stdenv.mkDerivation rec {
   pname = "SDL_image";
   version = "1.2.6";
 
@@ -12,11 +13,9 @@ stdenv.mkDerivation (rec {
 
   buildInputs = [SDL libpng libjpeg libtiff libungif libXpm];
 
-  postInstall = "ln -s \${out}/include/SDL/SDL_image.h \${out}/include/";
+  postInstall = "ln -s $out/include/SDL/SDL_image.h $out/include/";
 
   meta = {
-    description = "
-      SDL image library.
-";
+    description = "SDL image library";
   };
-})
+}
diff --git a/pkgs/development/libraries/SDL_mixer/default.nix b/pkgs/development/libraries/SDL_mixer/default.nix
index 024fd643be6f..bd7b66f21a19 100644
--- a/pkgs/development/libraries/SDL_mixer/default.nix
+++ b/pkgs/development/libraries/SDL_mixer/default.nix
@@ -1,5 +1,6 @@
 args: with args;
-stdenv.mkDerivation (rec {
+
+stdenv.mkDerivation rec {
   pname = "SDL_mixer";
   version = "1.2.8";
 
@@ -14,11 +15,9 @@ stdenv.mkDerivation (rec {
 
   configureFlags = "--disable-music-ogg-shared";
 
-  postInstall = "ln -s \${out}/include/SDL/SDL_mixer.h \${out}/include/";
+  postInstall = "ln -s $out/include/SDL/SDL_mixer.h $out/include/";
 
   meta = {
-    description = "
-      SDL multi-channel audio mixer library.
-";
+    description = "SDL multi-channel audio mixer library";
   };
-})
+}
diff --git a/pkgs/development/libraries/SDL_net/default.nix b/pkgs/development/libraries/SDL_net/default.nix
index 7de557322f66..6c8c79d701c1 100644
--- a/pkgs/development/libraries/SDL_net/default.nix
+++ b/pkgs/development/libraries/SDL_net/default.nix
@@ -1,5 +1,6 @@
 args: with args;
-stdenv.mkDerivation (rec {
+
+stdenv.mkDerivation rec {
   pname = "SDL_net";
   version = "1.2.7";
 
@@ -12,11 +13,9 @@ stdenv.mkDerivation (rec {
 
   buildInputs = [SDL];
 
-  postInstall = "ln -s \${out}/include/SDL/SDL_net.h \${out}/include/";
+  postInstall = "ln -s $out/include/SDL/SDL_net.h $out/include/";
 
   meta = {
-    description = "
-      SDL networking library.
-";
+    description = "SDL networking library";
   };
-})
+}
diff --git a/pkgs/development/libraries/SDL_ttf/default.nix b/pkgs/development/libraries/SDL_ttf/default.nix
index c7a356adc613..29c1df93a50f 100644
--- a/pkgs/development/libraries/SDL_ttf/default.nix
+++ b/pkgs/development/libraries/SDL_ttf/default.nix
@@ -1,19 +1,18 @@
 args: with args;
+
 stdenv.mkDerivation {
-  name = "SDL_image-1.2.6";
+  name = "SDL_ttf-2.0.9";
 
   src = fetchurl {
-		url = http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.9.tar.gz;
-		sha256 = "0ls6anmlmwrmy21p3y9nfyl6fkwz4jpgh74kw7xd0hwbg5v8h95l";
-	};
+    url = http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-2.0.9.tar.gz;
+    sha256 = "0ls6anmlmwrmy21p3y9nfyl6fkwz4jpgh74kw7xd0hwbg5v8h95l";
+  };
 
   buildInputs = [SDL freetype];
 
-  postInstall = "ln -s \${out}/include/SDL/SDL_ttf.h \${out}/include/";
+  postInstall = "ln -s $out/include/SDL/SDL_ttf.h $out/include/";
 
   meta = {
-    description = "
-	SDL image library.
-";
+    description = "SDL TrueType library";
   };
 }
diff --git a/pkgs/development/libraries/chmlib/default.nix b/pkgs/development/libraries/chmlib/default.nix
index bd593aaea0a5..4f27a133c99e 100644
--- a/pkgs/development/libraries/chmlib/default.nix
+++ b/pkgs/development/libraries/chmlib/default.nix
@@ -1,16 +1,16 @@
-args: with args;
+{stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "chmlib-0.39";
+  
   src = fetchurl {
     url = "${meta.homepage}/${name}.tar.bz2";
-	sha256 = "0hgzw121ffmk79wbpkd0394y5ah99c3i85z6scp958mmkr25sc6j";
+    sha256 = "0hgzw121ffmk79wbpkd0394y5ah99c3i85z6scp958mmkr25sc6j";
   };
 
   meta = {
-	  homepage = http://www.jedrea.com/chmlib;
-	  license = "LGPL";
-	  description = "CHLIB is a library for dealing with Microsoft ITSS/CHM
-	  format files";
+    homepage = http://www.jedrea.com/chmlib;
+    license = "LGPL";
+    description = "A library for dealing with Microsoft ITSS/CHM format files";
   };
 }
diff --git a/pkgs/development/libraries/faad2/default.nix b/pkgs/development/libraries/faad2/default.nix
index 23566428529f..733724f2a42f 100644
--- a/pkgs/development/libraries/faad2/default.nix
+++ b/pkgs/development/libraries/faad2/default.nix
@@ -1,19 +1,18 @@
-args:
-args.stdenv.mkDerivation {
-  name = "faad2-2.6.1";
+{stdenv, fetchurl}:
 
-  src = args.fetchurl {
-    url = http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz;
-    sha256 = "0p1870qfpaadphdfphbcfalf6d25r30k3y1f7sa7ly4vq3hc5lla";
-  };
+stdenv.mkDerivation {
+  name = "faad2-2.7";
 
-  preConfigure = "./bootstrap";
+  src = fetchurl {
+    url = mirror://sourceforge/faac/faad2-2.7.tar.bz2;
+    sha256 = "1db37ydb6mxhshbayvirm5vz6j361bjim4nkpwjyhmy4ddfinmhl";
+  };
 
-  buildInputs =(with args; [autoconf automake libtool]);
+  configureFlags = "--disable-static";
 
   meta = {
-      description="AAC audio decoding library";
-      homepage = http://www.audiocoding.com/faad2.html;
-      license = "GPLv2";
+    description = "An open source MPEG-4 and MPEG-2 AAC decoder";
+    homepage = http://www.audiocoding.com/faad2.html;
+    license = "GPLv2";
   };
 }
diff --git a/pkgs/development/libraries/ffmpeg/default.nix b/pkgs/development/libraries/ffmpeg/default.nix
index 6aec8ecbb063..33f003095a67 100644
--- a/pkgs/development/libraries/ffmpeg/default.nix
+++ b/pkgs/development/libraries/ffmpeg/default.nix
@@ -1,11 +1,31 @@
-{stdenv, fetchurl}:
+{stdenv, fetchurl, faad2}:
 
 stdenv.mkDerivation {
-  name = "ffmpeg-20051126";
+  name = "ffmpeg-0.5";
+  
   src = fetchurl {
-    url = http://downloads.videolan.org/pub/videolan/vlc/0.8.4a/contrib/ffmpeg-20051126.tar.bz2;
-    md5 = "f9e50bf9ee1dd248a276bf9bd4d606e0";
+    url = http://www.ffmpeg.org/releases/ffmpeg-0.5.tar.bz2;
+    sha1 = "f930971bc0ac3d11a4ffbb1af439425c24f6f5b1";
+  };
+  
+  # `--enable-gpl' (as well as the `postproc' and `swscale') mean that
+  # the resulting library is GPL'ed, so it can only be used in GPL'ed
+  # applications.
+  configureFlags = ''
+    --enable-shared
+    --disable-static
+    --enable-gpl
+    --enable-postproc
+    --enable-swscale
+    --disable-ffserver
+    --disable-ffplay
+    --enable-libfaad
+  '';
+
+  buildInputs = [faad2];
+
+  meta = {
+    homepage = http://www.ffmpeg.org/;
+    description = "A complete, cross-platform solution to record, convert and stream audio and video";
   };
-  # !!! Hm, what are the legal consequences of --enable-gpl?
-  configureFlags = "--enable-shared --enable-pp --enable-shared-pp --enable-gpl --disable-ffserver --disable-ffplay";
 }
diff --git a/pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix b/pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix
deleted file mode 100644
index acfdfa6a5532..000000000000
--- a/pkgs/development/libraries/ffmpeg_svn_snapshot/default.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{stdenv, fetchurl}:
-
-stdenv.mkDerivation {
-  name = "ffmpeg-svn-pre-r11901";
-  src = fetchurl {
-    url = http://nixos.org/tarballs/ffmpeg-svn-r11901.tar.bz2;
-    sha256 = "0l5207gnfaz57pvlxpxyjphyz0mp9plnxzd0aghy0nz3hmqh4rs7";
-  };
-  # !!! Hm, what are the legal consequences of --enable-gpl?
-  configureFlags = "--enable-shared --enable-pp --enable-gpl --disable-ffserver --disable-ffplay";
-}
diff --git a/pkgs/development/libraries/fftw/default.nix b/pkgs/development/libraries/fftw/default.nix
index 270d12ac6ab4..f3604c7d32f1 100644
--- a/pkgs/development/libraries/fftw/default.nix
+++ b/pkgs/development/libraries/fftw/default.nix
@@ -17,9 +17,7 @@ stdenv.mkDerivation {
 	builder = writeScript "fftw-3.1.2-builder"
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare]);
 	meta = {
-		description = "
-	Fastest Fourier Transform in the West library.
-";
+		description = "Fastest Fourier Transform in the West library";
 		inherit src;
 	};
 }
diff --git a/pkgs/development/libraries/fltk/default.nix b/pkgs/development/libraries/fltk/default.nix
index 6632088ade7a..d3a9f9ea3e89 100644
--- a/pkgs/development/libraries/fltk/default.nix
+++ b/pkgs/development/libraries/fltk/default.nix
@@ -1,47 +1,45 @@
 args: with args;
 let inherit (args.composableDerivation) composableDerivation edf; in
-composableDerivation {
-  initial = {
+composableDerivation {} {
 
-    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";
-    };
+  src = args.fetchurl {
+    url = ftp://ftp.easysw.com/pub/fltk/snapshots/fltk-2.0.x-r6483.tar.bz2;
+    sha256 = "1n8b53r5p0zb4sbvr6pj8aasls4zjwksv1sdc3r3pzb20fikp5jb";
+  };
 
-    propagatedBuildInputs=[x11 inputproto libXi freeglut];
+  propagatedBuildInputs=[x11 inputproto libXi freeglut];
 
-    buildInputs = [ args.pkgconfig ];
+  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;
-    };
+  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;
-    };
+  meta = {
+      description = "a C++ cross platform lightweight gui library binding";
+      homepage = http://www.fltk.org;
   };
 }
diff --git a/pkgs/development/libraries/fmod/default.nix b/pkgs/development/libraries/fmod/default.nix
new file mode 100644
index 000000000000..f73480b3ce46
--- /dev/null
+++ b/pkgs/development/libraries/fmod/default.nix
@@ -0,0 +1,28 @@
+{stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "fmod-42204";
+  src = if (stdenv.system == "i686-linux") then
+    fetchurl {
+      url = http://www.fmod.org/index.php/release/version/fmodapi42204linux.tar.gz;
+      sha256 = "64eedc5b37c597eb925de446106d75cab0b5a79697d5ec048d34702812c08563";
+    } else if (stdenv.system == "x86_64-linux") then
+    fetchurl {
+      url = http://www.fmod.org/index.php/release/version/fmodapi42204linux64.tar.gz;
+      sha256 = "3f2eec8265838a1005febe07c4971660e85010e4622911890642dc438746edf3";
+    } else throw "unsupported platform ${stdenv.system} (only i686-linux and x86_64 linux supported yet)";
+
+  preInstall = ''
+    sed -e /ldconfig/d -i Makefile
+    sed -e s@/usr/local@$out@ -i Makefile
+    sed -e s@/include/fmodex@/include@ -i Makefile
+    mkdir -p $out/lib
+    mkdir -p $out/include
+  '';
+
+  meta = {
+    homepage = http://www.fmod.org/;
+    description = "Programming library and toolkit for the creation and playback of interactive audio";
+    license = "unfree";
+  };
+}
diff --git a/pkgs/development/libraries/fribidi/default.nix b/pkgs/development/libraries/fribidi/default.nix
index a9394e00da4a..c29900582c6c 100644
--- a/pkgs/development/libraries/fribidi/default.nix
+++ b/pkgs/development/libraries/fribidi/default.nix
@@ -1,9 +1,15 @@
 {stdenv, fetchurl}:
 
 stdenv.mkDerivation {
-  name = "fribidi-0.10.7";
+  name = "fribidi-0.10.9";
+  
   src = fetchurl {
-    url = http://fribidi.org/download/fribidi-0.10.7.tar.gz;
-    md5 = "0f602ed32869dbc551dc6bc83d8a3d28";
+    url = http://fribidi.org/download/fribidi-0.10.9.tar.gz;
+    sha256 = "1d479wbygqmxcsyg3g7d6nmzlaa3wngy21ci5qcc5nhbyn97bz5q";
+  };
+
+  meta = {
+    homepage = http://fribidi.org/;
+    description = "GNU implementation of the Unicode Bidirectional Algorithm (bidi)";
   };
 }
diff --git a/pkgs/development/libraries/geos/default.nix b/pkgs/development/libraries/geos/default.nix
index 10cc4d94d404..d30f55b95c62 100644
--- a/pkgs/development/libraries/geos/default.nix
+++ b/pkgs/development/libraries/geos/default.nix
@@ -1,38 +1,35 @@
 args: with args;
 let inherit (args.composableDerivation) composableDerivation edf; in
-composableDerivation {
+composableDerivation {} {
 
-  initial = {
+  buildInputs = [ "which" ]; # which is needed for the autogen.sh
 
-    buildInputs = [ "which" ]; # which is needed for the autogen.sh
+  flags =
+  # python and ruby untested 
+    edf { name = "python"; enable = { buildInputs = [ python ]; }; };
+    # (if args.use_svn then ["libtool" "autoconf" "automake" "swig"] else [])
+    # // edf { name = "ruby"; enable = { buildInputs = [ ruby ]; };}
 
-    flags =
-    # python and ruby untested 
-      edf { name = "python"; enable = { buildInputs = [ python ]; }; };
-      # (if args.use_svn then ["libtool" "autoconf" "automake" "swig"] else [])
-      # // edf { name = "ruby"; enable = { buildInputs = [ ruby ]; };}
+  name = "geos-3.0.3";
 
-    name = "geos-3.0.3";
-
-    src = fetchurl {
-        url = http://download.osgeo.org/geos/geos-3.0.3.tar.bz2;
-        sha256 = "1pxk20jcbyidp3bvip1vdf8wfw2wvh8pcn810qkf1y3zfnki0c7k";
-    };
+  src = fetchurl {
+      url = http://download.osgeo.org/geos/geos-3.0.3.tar.bz2;
+      sha256 = "1pxk20jcbyidp3bvip1vdf8wfw2wvh8pcn810qkf1y3zfnki0c7k";
+  };
 
-    # for development version. can be removed ?
-    #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";
   };
 }
diff --git a/pkgs/development/libraries/lcms/default.nix b/pkgs/development/libraries/lcms/default.nix
index 13018d29dcb2..63cd477549c5 100644
--- a/pkgs/development/libraries/lcms/default.nix
+++ b/pkgs/development/libraries/lcms/default.nix
@@ -1,10 +1,16 @@
 {stdenv, fetchurl}:
 
 stdenv.mkDerivation {
-  name = "lcms-1.14";
+  name = "lcms-1.17";
 
   src = fetchurl {
-    url = http://nixos.org/tarballs/lcms-1.14.tar.gz;
-    md5 = "5a803460aeb10e762d97e11a37462a69";
+    url = http://www.littlecms.com/lcms-1.17.tar.gz;
+    sha256 = "10s5s6b6r5mhf0g6l431l6fwymhjzqrvm7g214h7fmh9ngdb9wsy";
+  };
+
+  meta = {
+    description = "Color management engine";
+    homepage = http://www.littlecms.com/;
+    license = "MIT";
   };
 }
diff --git a/pkgs/development/libraries/libao/default.nix b/pkgs/development/libraries/libao/default.nix
index cb42848585bc..6411657c6b69 100644
--- a/pkgs/development/libraries/libao/default.nix
+++ b/pkgs/development/libraries/libao/default.nix
@@ -10,9 +10,11 @@ stdenv.mkDerivation {
   buildInputs = [pkgconfig];
 
   meta = {
-    description = ''Libao is Xiph.org's cross-platform audio
-                    library that allows programs to output audio
-		    using a simple API on a wide variety of platforms.'';
+    longDescription = ''
+      Libao is Xiph.org's cross-platform audio library that allows
+      programs to output audio using a simple API on a wide variety of
+      platforms.
+    '';
     homepage = http://xiph.org/ao/;
     license = "GPL";
   };
diff --git a/pkgs/development/libraries/libcv/default.nix b/pkgs/development/libraries/libcv/default.nix
index 7daa084c8e54..649d0a5728f2 100644
--- a/pkgs/development/libraries/libcv/default.nix
+++ b/pkgs/development/libraries/libcv/default.nix
@@ -26,7 +26,7 @@ rec {
     ln -s $out/include/opencv/* $out/include
   '') ["doMakeInstall" "minInit"];
       
-  name = "libcv-" + version;
+  name = "libcv-0.9.7";
   meta = {
     description = "libcv - computer vision library";
   };
diff --git a/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix b/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix
index 575d141fcf5c..add438d07f1a 100644
--- a/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix
+++ b/pkgs/development/libraries/libdbi-drivers/0.8.2-1.nix
@@ -29,13 +29,11 @@ args : with args;
 	};
 	in with localDefs;
 stdenv.mkDerivation rec {
-	name = "libdbi"+version;
+	name = "libdbi-"+version;
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	DB independent interface to DB; DB drivers (mysql only for now).
-";
+		description = "DB independent interface to DB; DB drivers (mysql only for now)";
 		inherit src;
 	};
 }
diff --git a/pkgs/development/libraries/libdbi/0.8.2.nix b/pkgs/development/libraries/libdbi/0.8.2.nix
index fd7b950c3ce6..dd0f2ec1c5f9 100644
--- a/pkgs/development/libraries/libdbi/0.8.2.nix
+++ b/pkgs/development/libraries/libdbi/0.8.2.nix
@@ -11,13 +11,11 @@ args : with args;
 	};
 	in with localDefs;
 stdenv.mkDerivation rec {
-	name = "libdbi"+version;
+	name = "libdbi-"+version;
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	DB independent interface to DB.	
-";
+		description = "DB independent interface to DB";
 		inherit src;
 	};
 }
diff --git a/pkgs/development/libraries/libdv/default.nix b/pkgs/development/libraries/libdv/default.nix
index 70211e928ee8..69011a6ef97e 100644
--- a/pkgs/development/libraries/libdv/default.nix
+++ b/pkgs/development/libraries/libdv/default.nix
@@ -1,29 +1,28 @@
 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 { 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
+composableDerivation {} {
 
-    name = "libdv-1.0.0";
+  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 { 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
 
-    src = args.fetchurl {
-      url = mirror://sourceforge/libdv/libdv-1.0.0.tar.gz;
-      sha256 = "1fl96f2xh2slkv1i1ix7kqk576a0ak1d33cylm0mbhm96d0761d3";
-    };
+  name = "libdv-1.0.0";
 
-    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 = [];
-    };
+  src = args.fetchurl {
+    url = mirror://sourceforge/libdv/libdv-1.0.0.tar.gz;
+    sha256 = "1fl96f2xh2slkv1i1ix7kqk576a0ak1d33cylm0mbhm96d0761d3";
+  };
+
+  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 = [];
   };
 }
diff --git a/pkgs/development/libraries/libdvdcss/default.nix b/pkgs/development/libraries/libdvdcss/default.nix
index e8e9da175447..73755ab33864 100644
--- a/pkgs/development/libraries/libdvdcss/default.nix
+++ b/pkgs/development/libraries/libdvdcss/default.nix
@@ -1,9 +1,15 @@
 {stdenv, fetchurl}:
 
 stdenv.mkDerivation {
-  name = "libdvdcss-1.2.9";
+  name = "libdvdcss-1.2.10";
+  
   src = fetchurl {
-    url = http://download.videolan.org/pub/libdvdcss/1.2.9/libdvdcss-1.2.9.tar.bz2;
-    md5 = "553383d898826c285afb2ee453b07868";
+    url = http://download.videolan.org/pub/libdvdcss/1.2.10/libdvdcss-1.2.10.tar.bz2;
+    sha256 = "0812zxg4b6yjkckzwdzfzb4jnffykr9567f9v29barmb2d8ag513";
+  };
+
+  meta = {
+    homepage = http://www.videolan.org/developers/libdvdcss.html;
+    description = "A library for decrypting DVDs";
   };
 }
diff --git a/pkgs/development/libraries/libdvdnav/default.nix b/pkgs/development/libraries/libdvdnav/default.nix
index 48f990ea9ba6..7d6ddd61581f 100644
--- a/pkgs/development/libraries/libdvdnav/default.nix
+++ b/pkgs/development/libraries/libdvdnav/default.nix
@@ -1,9 +1,25 @@
-{stdenv, fetchurl}:
+{stdenv, fetchurl, libdvdread}:
 
 stdenv.mkDerivation {
-  name = "libdvdnav-20050211";
+  name = "libdvdnav-4.1.3";
+  
   src = fetchurl {
-    url = http://downloads.videolan.org/pub/videolan/vlc/0.8.4a/contrib/libdvdnav-20050211.tar.bz2;
-    md5 = "e1b1d45c8fdaf6a2dce3078bd3d7047d";
+    url = http://www2.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdnav-4.1.3.tar.bz2;
+    sha1 = "d1b95eb8a7caee1fa7580a1abad84d6cb3cad046";
   };
+
+  buildInputs = [libdvdread];
+
+  configureScript = "./configure2"; # wtf?
+
+  preConfigure = ''
+    ensureDir $out
+  '';
+
+  meta = {
+    homepage = http://www.mplayerhq.hu/;
+    description = "A library that implements DVD navigation features such as DVD menus";
+  };
+
+  passthru = { inherit libdvdread; };
 }
diff --git a/pkgs/development/libraries/libdvdread/default.nix b/pkgs/development/libraries/libdvdread/default.nix
index fd0eee12ae40..30fd6835dfbb 100644
--- a/pkgs/development/libraries/libdvdread/default.nix
+++ b/pkgs/development/libraries/libdvdread/default.nix
@@ -1,11 +1,29 @@
 {stdenv, fetchurl, libdvdcss}:
 
 stdenv.mkDerivation {
-  name = "libdvdread-0.9.6";
+  name = "libdvdread-4.1.3";
+  
   src = fetchurl {
-    url = http://www.dtek.chalmers.se/groups/dvd/dist/libdvdread-0.9.6.tar.gz;
-    md5 = "329401b84ad0b00aaccaad58f2fc393c";
+    url = http://www.mplayerhq.hu/MPlayer/releases/dvdnav/libdvdread-4.1.3.tar.bz2;
+    sha1 = "fc4c7ba3e49929191e057b435bc4f867583ea8d5";
+  };
+
+  buildInputs = [libdvdcss];
+
+  NIX_LDFLAGS = "-ldvdcss";
+
+  configureScript = "./configure2"; # wtf?
+
+  preConfigure = ''
+    ensureDir $out
+  '';
+
+  postInstall = ''
+    ln -s dvdread $out/include/libdvdread
+  '';
+
+  meta = {
+    homepage = http://www.mplayerhq.hu/;
+    description = "A library for reading DVDs";
   };
-  configureFlags = "--with-libdvdcss=${libdvdcss}";
-  inherit libdvdcss;
 }
diff --git a/pkgs/development/libraries/libextractor/0.5.18.nix b/pkgs/development/libraries/libextractor/0.5.18.nix
index da3bafd915b9..ed56e5ce4feb 100644
--- a/pkgs/development/libraries/libextractor/0.5.18.nix
+++ b/pkgs/development/libraries/libextractor/0.5.18.nix
@@ -11,13 +11,11 @@ args : with args;
 	};
 	in with localDefs;
 stdenv.mkDerivation rec {
-	name = "libextractor"+version;
+	name = "libextractor-"+version;
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	Libextractor - extracts metadata from files.
-";
+		description = "A tool to extract metadata from files";
 		inherit src;
 	};
 }
diff --git a/pkgs/development/libraries/libical/default.nix b/pkgs/development/libraries/libical/default.nix
new file mode 100644
index 000000000000..ab7ee1b2da54
--- /dev/null
+++ b/pkgs/development/libraries/libical/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, perl}:
+
+stdenv.mkDerivation {
+  name = "libical-0.43";
+  src = fetchurl {
+    url = http://superb-east.dl.sourceforge.net/sourceforge/freeassociation/libical-0.43.tar.gz;
+    md5 = "5f0a1feb60894d0be537aefea5647474";
+  };
+  buildInputs = [ perl ];
+}
diff --git a/pkgs/development/libraries/libidn/default.nix b/pkgs/development/libraries/libidn/default.nix
index d68397ff9ec7..11e49acad145 100644
--- a/pkgs/development/libraries/libidn/default.nix
+++ b/pkgs/development/libraries/libidn/default.nix
@@ -1,15 +1,37 @@
-args: with args;
-
-stdenv.mkDerivation {
-	name = "libidn-1.2";
-	src = fetchurl {
-		url = mirror://gnu/libidn/libidn-1.2.tar.gz;
-		sha256 = "0cip97xskrsfp6v1v966jb921srl1s65a5d8s0l73s85yww55n73";
-	};
-
-	meta = {
-		homepage = http://www.gnu.org/software/libidn;
-		description = "GNU Libidn library for internationalized domain names";
-		license = "LGPL";
-	};
+{ fetchurl, stdenv }:
+
+stdenv.mkDerivation rec {
+  name = "libidn-1.13";
+
+  src = fetchurl {
+    url = "mirror://gnu/libidn/${name}.tar.gz";
+    sha256 = "07p7cnmfnq7ds8a56iqmxps46bzznn92xxpdlnnp3n6pwcnidmn7";
+  };
+
+  configureFlags = "--disable-static";
+
+  doCheck = true;
+
+  meta = {
+    homepage = http://www.gnu.org/software/libidn/;
+    description = "GNU Libidn library for internationalized domain names";
+
+    longDescription = ''
+      GNU Libidn is a fully documented implementation of the
+      Stringprep, Punycode and IDNA specifications.  Libidn's purpose
+      is to encode and decode internationalized domain names.  The
+      native C, C\# and Java libraries are available under the GNU
+      Lesser General Public License version 2.1 or later.
+
+      The library contains a generic Stringprep implementation.
+      Profiles for Nameprep, iSCSI, SASL, XMPP and Kerberos V5 are
+      included.  Punycode and ASCII Compatible Encoding (ACE) via IDNA
+      are supported.  A mechanism to define Top-Level Domain (TLD)
+      specific validation tables, and to compare strings against those
+      tables, is included.  Default tables for some TLDs are also
+      included.
+    '';
+
+    license = "LGPLv2+";
+  };
 }
diff --git a/pkgs/development/libraries/libixp_for_wmii/default.nix b/pkgs/development/libraries/libixp_for_wmii/default.nix
index c3fcd0d8100c..52d6288316f7 100644
--- a/pkgs/development/libraries/libixp_for_wmii/default.nix
+++ b/pkgs/development/libraries/libixp_for_wmii/default.nix
@@ -14,7 +14,13 @@ stdenv.mkDerivation {
      cp -r lib \$out
   ";
   src = fetchurl {
-    url = http://www.suckless.org/download/libixp-0.4.tar.gz;
+    url = http://code.suckless.org/dl/libs/libixp-0.4.tar.gz;
     sha256 = "0b44p9wvmzxpyf2xd86rxyr49bmfh9cd5hj3d234gkvynvgph60p";
   };
+
+  meta = {
+    homepage = http://libs.suckless.org/libixp;
+    description = "stand-alone client/server 9P library";
+    license = "MIT / LPL";
+  };
 }
diff --git a/pkgs/development/libraries/libksba/default.nix b/pkgs/development/libraries/libksba/default.nix
index 573064f28897..5ff99341da14 100644
--- a/pkgs/development/libraries/libksba/default.nix
+++ b/pkgs/development/libraries/libksba/default.nix
@@ -1,19 +1,19 @@
 args: with args;
+
 stdenv.mkDerivation rec {
-	name = "libksba-1.0.2";
+  name = "libksba-1.0.2";
 
-	src = fetchurl {
-		url = "ftp://ftp.gnupg.org/gcrypt/libksba/${name}.tar.bz2";
-		sha256 = "1jkjh1daaykkrfq0s4vv8ddf0w8agdvspg9qm0ghjidlrfnsfiwh";
-	};
+  src = fetchurl {
+    url = "ftp://ftp.gnupg.org/gcrypt/libksba/${name}.tar.bz2";
+    sha256 = "1jkjh1daaykkrfq0s4vv8ddf0w8agdvspg9qm0ghjidlrfnsfiwh";
+  };
 
-	propagatedBuildInputs = [libgpgerror];
+  propagatedBuildInputs = [libgpgerror];
 
-	configureFlags = "--enable-shared --disable-static";
+  configureFlags = "--enable-shared --disable-static";
 
-	meta = {
-		homepage = http://www.gnupg.org;
-		description = "Libksba  is a CMS and X.509 access library under
-		development";
-	};
+  meta = {
+    homepage = http://www.gnupg.org;
+    description = "Libksba is a CMS and X.509 access library under development";
+  };
 }
diff --git a/pkgs/development/libraries/libmad/default.nix b/pkgs/development/libraries/libmad/default.nix
index 6387be4b4cbe..aa5c3526e857 100644
--- a/pkgs/development/libraries/libmad/default.nix
+++ b/pkgs/development/libraries/libmad/default.nix
@@ -15,6 +15,6 @@ stdenv.mkDerivation {
 
   meta = {
     homepage = http://sourceforge.net/projects/mad/;
-    description = "MAD, a high-quality, fixed-point, MPEG audio decoder supporting MPEG-1 and MPEG-2.";
+    description = "A high-quality, fixed-point MPEG audio decoder supporting MPEG-1 and MPEG-2";
   };
 }
diff --git a/pkgs/development/libraries/libmsn/default.nix b/pkgs/development/libraries/libmsn/default.nix
new file mode 100644
index 000000000000..a0afe811b562
--- /dev/null
+++ b/pkgs/development/libraries/libmsn/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, cmake, openssl}:
+
+stdenv.mkDerivation {
+  name = "libmsn-4.0beta4";
+  src = fetchurl {
+    url = mirror://sourceforge/libmsn/libmsn-4.0-beta4.tar.bz2;
+    md5 = "b0155f01443644d7c4a60269e44d8dac";
+  };
+  buildInputs = [ cmake openssl ];
+}
diff --git a/pkgs/development/libraries/liboil/0.3.13.nix b/pkgs/development/libraries/liboil/0.3.13.nix
index 3cb6ad6f9923..b1425e454fbc 100644
--- a/pkgs/development/libraries/liboil/0.3.13.nix
+++ b/pkgs/development/libraries/liboil/0.3.13.nix
@@ -14,7 +14,6 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = http://liboil.freedesktop.org;
-    description = "Liboil is a library of simple functions that are optimized
-    for various CPUs.";
+    description = "A library of simple functions that are optimized for various CPUs";
   };
 }
diff --git a/pkgs/development/libraries/liboil/0.3.15.nix b/pkgs/development/libraries/liboil/0.3.15.nix
index db068d2dec30..b777a1195f92 100644
--- a/pkgs/development/libraries/liboil/0.3.15.nix
+++ b/pkgs/development/libraries/liboil/0.3.15.nix
@@ -14,7 +14,6 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = http://liboil.freedesktop.org;
-    description = "Liboil is a library of simple functions that are optimized
-    for various CPUs.";
+    description = "A library of simple functions that are optimized for various CPUs";
   };
 }
diff --git a/pkgs/development/libraries/libwmf/default.nix b/pkgs/development/libraries/libwmf/default.nix
index 6f580613b16f..7f7d76931824 100644
--- a/pkgs/development/libraries/libwmf/default.nix
+++ b/pkgs/development/libraries/libwmf/default.nix
@@ -1,18 +1,16 @@
 args: with args;
+
 stdenv.mkDerivation {
   name = "libwmf-0.2.8.4";
 
   src = fetchurl {
-		url = mirror://sourceforge/wvware/libwmf-0.2.8.4.tar.gz;
-		sha256 = "1y3wba4q8pl7kr51212jwrsz1x6nslsx1gsjml1x0i8549lmqd2v";
-	};
+    url = mirror://sourceforge/wvware/libwmf-0.2.8.4.tar.gz;
+    sha256 = "1y3wba4q8pl7kr51212jwrsz1x6nslsx1gsjml1x0i8549lmqd2v";
+  };
 
-  buildInputs = [zlib imagemagick libpng
-	pkgconfig glib freetype libjpeg libxml2];
+  buildInputs = [zlib imagemagick libpng pkgconfig glib freetype libjpeg libxml2];
 
   meta = {
-    description = "
-	WMF library from wvWare.
-";
+    description = "WMF library from wvWare";
   };
 }
diff --git a/pkgs/development/libraries/lzo/default.nix b/pkgs/development/libraries/lzo/default.nix
index 64d03c434c2f..834b7abf5930 100644
--- a/pkgs/development/libraries/lzo/default.nix
+++ b/pkgs/development/libraries/lzo/default.nix
@@ -1,14 +1,17 @@
-args: with args;
+{stdenv, fetchurl}:
+
 stdenv.mkDerivation rec {
-	name = "lzo-2.02";
-	src = fetchurl {
-		url = "${meta.homepage}/download/${name}.tar.gz";
-		sha256 = "1i9g9bdrmyn6546rnck3kkh8nssfaw75m2rxir4sn7bwvnsfryx2";
-	};
-	configureFlags = "--enable-shared --disable-static";
-	meta = {
-		description = "LZO is a data compresion library which is suitable for
-		data de-/compression in real-time";
-		homepage = http://www.oberhumer.com/opensource/lzo;
-	};
+  name = "lzo-2.02";
+  
+  src = fetchurl {
+    url = "${meta.homepage}/download/${name}.tar.gz";
+    sha256 = "1i9g9bdrmyn6546rnck3kkh8nssfaw75m2rxir4sn7bwvnsfryx2";
+  };
+  
+  configureFlags = "--enable-shared --disable-static";
+  
+  meta = {
+    description = "A data compresion library suitable for real-time data de-/compression";
+    homepage = http://www.oberhumer.com/opensource/lzo;
+  };
 }
diff --git a/pkgs/development/libraries/mpich2/default.nix b/pkgs/development/libraries/mpich2/default.nix
index b92eed68bdea..7fb0e009f4ae 100644
--- a/pkgs/development/libraries/mpich2/default.nix
+++ b/pkgs/development/libraries/mpich2/default.nix
@@ -2,18 +2,20 @@
 
 stdenv.mkDerivation rec {
   name = "mpich2-1.0.6p1";
+  
   src = fetchurl {
-    url = "http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/"
-      + name + ".tar.gz";
+    url = "http://www.mcs.anl.gov/research/projects/mpich2/downloads/tarballs/${name}.tar.gz";
     sha256 = "1k0za8951j5fn89ww6bsy9b4yi989zz7bnd8a6acfr8r0yb8z01q";
   };
 
   buildInputs = [ python ];
 
   meta = {
-    description = ''MPICH2 is a free high-performance and portable
-                    implementation of the Message Passing Interface
-		    (MPI) standard, both version 1 and version 2.'';
+    longDescription = ''
+      MPICH2 is a free high-performance and portable implementation of
+      the Message Passing Interface (MPI) standard, both version 1 and
+      version 2.
+    '';
     homepage = http://www.mcs.anl.gov/mpi/mpich2/;
     license = "free, see http://www.mcs.anl.gov/research/projects/mpich2/downloads/index.php?s=license";
   };
diff --git a/pkgs/development/libraries/openbabel/default.nix b/pkgs/development/libraries/openbabel/default.nix
index 10c8dcf0a684..2b994edd74c3 100644
--- a/pkgs/development/libraries/openbabel/default.nix
+++ b/pkgs/development/libraries/openbabel/default.nix
@@ -1,13 +1,14 @@
-args: with args;
+{stdenv, fetchurl, zlib, libxml2}:
+
 stdenv.mkDerivation {
-	name = "openbabel-2.1.1";
-	src = fetchurl { 
-		url = mirror://sf/openbabel/openbabel-2.1.1.tar.gz;
-		sha256 = "1rgvci796a7bmc49ih26ma7c248d32w6drs3cwljpjk0dllsqdif";
-	};
+  name = "openbabel-2.2.1";
+  src = fetchurl { 
+    url = mirror://sf/openbabel/openbabel-2.2.1.tar.gz;
+    sha256 = "822345d70778de1d2d9afe65a659f1719b8ca300066fb1fa2f473bc97c457e80";
+  };
 # TODO : perl & python bindings;
 # TODO : wxGTK: I have no time to compile
 # TODO : separate lib and apps
-	buildInputs = [zlib libxml2];
-	configureFlags = "--enable-shared --disable-static";
+  buildInputs = [ zlib libxml2 ];
+  configureFlags = "--enable-shared --disable-static";
 }
diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix
index 4d7e49780452..c0abe7900f9a 100644
--- a/pkgs/development/libraries/poppler/default.nix
+++ b/pkgs/development/libraries/poppler/default.nix
@@ -5,34 +5,36 @@
 assert qt4Support -> (qt4 != null);
 
 stdenv.mkDerivation rec {
-	name = "poppler-0.8.4";
+  name = "poppler-0.10.4";
 
-	src = fetchurl {
-		url = "http://poppler.freedesktop.org/${name}.tar.gz";
-		sha256 = "0yi590vgqwjqmqspflxycbnfxjdcwa1fx9ark3diav3yn105gga5";
-	};
+  src = fetchurl {
+    url = "http://poppler.freedesktop.org/${name}.tar.gz";
+    sha256 = "15c53cn8ljhas0fbirp9s8sbgmaxpzg697c48zsdnz8zwm797gs1";
+  };
 
-	buildInputs = [pkgconfig zlib glib cairo freetype fontconfig libjpeg gtk]
+  buildInputs = [pkgconfig zlib glib cairo freetype fontconfig libjpeg gtk]
     ++ (if qt4Support then [qt4] else []);
 
-	configureFlags = "--enable-shared --disable-static --enable-exceptions
-	--enable-cairo --enable-splash --enable-poppler-glib --enable-zlib "
-  + (if qt4Support then "--enable-qt-poppler" else "--disable-qt-poppler");
-
-	patches = [ ./GDir-const.patch
-
-              # XXX: This patch no longer applies, what was the point of it?
-              # ./datadir_env.patch
+  configureFlags = "--enable-shared --disable-static --enable-exceptions
+    --enable-cairo --enable-splash --enable-poppler-glib --enable-zlib "
+    + (if qt4Support then "--enable-qt-poppler" else "--disable-qt-poppler");
 
-              ./use_exceptions.patch ];
+  patches = [ ./GDir-const.patch ./use_exceptions.patch ];
 
-	preConfigure = "sed -e '/jpeg_incdirs/s@/usr@${libjpeg}@' -i configure";
+  preConfigure = "sed -e '/jpeg_incdirs/s@/usr@${libjpeg}@' -i configure";
 
-  doCheck = true;
+  # XXX: The Poppler/Qt4 test suite refers to non-existent PDF files
+  # such as `../../../test/unittestcases/UseNone.pdf'.
+  doCheck = !qt4Support;
 
   meta = {
     homepage = http://poppler.freedesktop.org/;
     description = "Poppler, a PDF rendering library";
+
+    longDescription = ''
+      Poppler is a PDF rendering library based on the xpdf-3.0 code base.
+    '';
+
     license = "GPLv2";
   };
 }
diff --git a/pkgs/development/libraries/qt-4/default.nix b/pkgs/development/libraries/qt-4/default.nix
index f93ea9e8272f..a378a9dd94b4 100644
--- a/pkgs/development/libraries/qt-4/default.nix
+++ b/pkgs/development/libraries/qt-4/default.nix
@@ -60,7 +60,7 @@ stdenv.mkDerivation {
   # than half of the installed size.  Ideally we should put this in a
   # separate package (as well as the Qt Designer).
   postInstall = ''
-    rm -rf $out/share/doc
+    rm -rf $out/doc
   '';
 
   meta = {
diff --git a/pkgs/development/libraries/sqlite/default.nix b/pkgs/development/libraries/sqlite/default.nix
index fc8442395160..838ecc49c053 100644
--- a/pkgs/development/libraries/sqlite/default.nix
+++ b/pkgs/development/libraries/sqlite/default.nix
@@ -1,17 +1,23 @@
 {stdenv, fetchurl, readline}:
 
-stdenv.mkDerivation {
-  name = "sqlite-3.6.3";
+stdenv.mkDerivation rec {
+  name = "sqlite-3.6.10";
 
   # Note: don't use the "amalgamation" source release, since it
   # doesn't install sqlite3.pc.
   src = fetchurl {
-    url = http://www.sqlite.org/sqlite-3.6.3.tar.gz;
-    sha256 = "0kd9dpbrjp05159qsqwrm00h6a2cqjxqwpi33b6i5q8mr1bzkz1i";
+    url = "http://www.sqlite.org/${name}.tar.gz";
+    sha256 = "00dabyjg0530ng52b8lq6hwb6h181wl27ix5l7ayib0am8sdnmr1";
   };
 
   buildInputs = [readline];
 
+  configureFlags = "--disable-static --with-readline-inc=-I${readline}/include";
+
+  postInstall = ''
+    gcc -L$out/lib -I$out/include tool/genfkey.c -lsqlite3 -o $out/bin/genfkey
+  '';
+
   meta = {
     homepage = http://www.sqlite.org/;
     description = "A self-contained, serverless, zero-configuration, transactional SQL database engine";
diff --git a/pkgs/development/libraries/tapioca-qt/default.nix b/pkgs/development/libraries/tapioca-qt/default.nix
index 962a82a8a1a8..5d5fad9d9283 100644
--- a/pkgs/development/libraries/tapioca-qt/default.nix
+++ b/pkgs/development/libraries/tapioca-qt/default.nix
@@ -1,16 +1,10 @@
-args: with args;
-let rev = "2066"; in
-stdenv.mkDerivation {
-	name = "tapioca-qt-r${rev}";
-	src = fetchsvn {
-		url = "https://tapioca-voip.svn.sourceforge.net/svnroot/tapioca-voip/trunk/tapioca-qt";
-		inherit rev;
-		sha256 = "0r2qzlm56yizdi64xga6v2sdhdcgl3cvlsd7g9ynh95813nky88z";
-	};
+{stdenv, fetchurl, cmake, qt4, telepathy_qt}:
 
-	buildInputs = [cmake];
-	propagatedBuildInputs = [telepathy_qt stdenv.gcc.libc];
-	meta = {
-		description = "Qt Tapioca binding library";
-	};
+stdenv.mkDerivation {
+  name = "tapioca-qt-0.14.1";
+  src = fetchurl {
+    url = mirror://sourceforge/tapioca-voip/tapioca-qt-0.14.1.tar.gz;
+    md5 = "169318705af6386057b537c5317d520d";
+  };
+  buildInputs = [ cmake qt4 telepathy_qt ];
 }
diff --git a/pkgs/development/libraries/telepathy-qt/default.nix b/pkgs/development/libraries/telepathy-qt/default.nix
index 6e8e84399d1f..bf7acaef76a5 100644
--- a/pkgs/development/libraries/telepathy-qt/default.nix
+++ b/pkgs/development/libraries/telepathy-qt/default.nix
@@ -1,16 +1,10 @@
-args: with args;
-let rev = "2031"; in
-stdenv.mkDerivation {
-	name = "telepathy-qt-r${rev}";
-	src = fetchsvn {
-		url = "https://tapioca-voip.svn.sourceforge.net/svnroot/tapioca-voip/trunk/telepathy-qt";
-		inherit rev;
-		sha256 = "0d7psgc8nr5bryrjgfg92622hbilp0qwx0pya3836bz2l6x3msnb";
-	};
+{stdenv, fetchurl, cmake, qt4}:
 
-	buildInputs = [cmake];
-	propagatedBuildInputs = [qt stdenv.gcc.libc];
-	meta = {
-		description = "Qt bindings for telepathy";
-	};
+stdenv.mkDerivation {
+  name = "telepathy-qt-0.14.1";
+  src = fetchurl {
+    url = mirror://sourceforge/tapioca-voip/telepathy-qt-0.14.1.tar.gz;
+    md5 = "476e3fbd68b3eaf5354559be7de99333";
+  };
+  buildInputs = [ cmake qt4 ];
 }
diff --git a/pkgs/development/libraries/vxl/default.nix b/pkgs/development/libraries/vxl/default.nix
index 7cdb6963cd25..652c423fd7ef 100644
--- a/pkgs/development/libraries/vxl/default.nix
+++ b/pkgs/development/libraries/vxl/default.nix
@@ -9,6 +9,12 @@ stdenv.mkDerivation {
 
   buildInputs = [ cmake unzip libtiff expat zlib libpng libjpeg ];
 
+  cmakeFlags = if (stdenv.system == "x86_64-linux") then
+      "-DCMAKE_CXX_FLAGS=-fPIC -DCMAKE_C_FLAGS=-fPIC"
+    else
+      "";
+    
+
   meta = {
     description = "C++ Libraries for Computer Vision Research and Implementation";
     homepage = http://vxl.sourceforge.net/;
diff --git a/pkgs/development/libraries/wxGTK-2.8/default.nix b/pkgs/development/libraries/wxGTK-2.8/default.nix
index 11d7a1e29f35..3afb4a826096 100644
--- a/pkgs/development/libraries/wxGTK-2.8/default.nix
+++ b/pkgs/development/libraries/wxGTK-2.8/default.nix
@@ -34,7 +34,10 @@ stdenv.mkDerivation {
   SEARCH_INCLUDE =
     "${libXinerama}/include ${libSM}/include ${libXxf86vm}/include";
 
-  SEARCH_LIB = "${mesa}/lib";
+  SEARCH_LIB = if (stdenv.system == "x86_64-linux") then
+    "${mesa}/lib64"
+    else 
+    "${mesa}/lib";
 
   # Work around a bug in configure.
   NIX_CFLAGS_COMPILE = "-DHAVE_X11_XLIB_H=1";
diff --git a/pkgs/development/misc/avr-gcc-with-avr-libc/default.nix b/pkgs/development/misc/avr-gcc-with-avr-libc/default.nix
new file mode 100644
index 000000000000..46782889dfb3
--- /dev/null
+++ b/pkgs/development/misc/avr-gcc-with-avr-libc/default.nix
@@ -0,0 +1,74 @@
+args:
+args.stdenv.mkDerivation {
+  name = "avr-gcc-libc";
+
+  srcBinutils = args.fetchurl {
+    url = ftp://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2;
+    sha256 = "0pm20n2l9ddgdpgzk3zhnbb8nbyb4rb2kvcw21pkd6iwybk3rhz2";
+  };
+
+  srcGCC = args.fetchurl {
+    url = ftp://ftp.gnu.org/gnu/gcc/gcc-4.1.2/gcc-core-4.1.2.tar.bz2;
+    sha256 = "07binc1hqlr0g387zrg5sp57i12yzd5ja2lgjb83bbh0h3gwbsbv";
+  };
+
+  srcAVRLibc = args.fetchurl {
+    url = http://www.very-clever.com/download/nongnu/avr-libc/avr-libc-1.4.5.tar.bz2;
+    sha256 = "058iv3vs6syy01pfkd5894xap9zakjx8ki1bpjdnihn6vk6fr80l";
+  };
+
+  buildInputs =(with args; []);
+
+  phases = "doAll";
+
+  # don't call any wired $buildInputs/nix-support/* scripts or such. This makes the build fail 
+  builder = args.writeTextFile {
+    name = "avrbinutilsgccavrlibc-builder-script";
+    text =  ''
+    PATH=${args.coreutils}/bin:${args.gnumake}/bin:${args.gcc}/bin:${args.gnutar}/bin:${args.bzip2}/bin:${args.gnugrep}/bin:${args.gnused}/bin:${args.gawk}/bin
+    # that's all a bit too hacky...!
+    for i in `cat ${args.gcc}/nix-support/propagated-user-env-packages`; do
+      echo adding $i
+      PATH=$PATH:$i/bin
+    done
+    mkdir -p "$out"
+    export > env-vars
+
+    # important, without this gcc won't find the binutils executables
+    PATH=$PATH:$out/bin
+
+    prefix=$out
+
+    tar jxf $srcBinutils
+      cd binutils-*/
+      mkdir obj-avr
+      cd obj-avr
+      ../configure --target=avr --prefix="$prefix" --disable-nls --prefix=$prefix
+      make $MAKE_FLAGS
+      make install
+
+    cd $TMP
+    tar jxf $srcGCC
+      cd gcc-*
+      mkdir obj-avr
+      cd obj-avr
+      ../configure --target=avr --prefix="$prefix" --disable-nls --enable-languages=c --disable-libssp
+      make $MAKE_FLAGS
+      make install
+
+    cd $TMP
+      tar jxf $srcAVRLibc
+      cd avr-libc-*
+      ./configure --prefix="$prefix" --build=`./config.guess` --host=avr
+      make $MAKE_FLAGS
+      make install
+    '';
+  };
+
+  meta = { 
+      description = "avr gcc developement environment including binutils, avr-gcc and avr-libc";
+      # I've tried compiling the packages separately.. too much hassle. This just works. Fine.
+      license =  ["GPL" "LGPL"]; # see single packages ..
+      homepage = []; # dito
+  };
+}
diff --git a/pkgs/development/misc/avr8-burn-omat/default.nix b/pkgs/development/misc/avr8-burn-omat/default.nix
new file mode 100644
index 000000000000..b76f660c8c65
--- /dev/null
+++ b/pkgs/development/misc/avr8-burn-omat/default.nix
@@ -0,0 +1,32 @@
+args:
+args.stdenv.mkDerivation {
+  name = "avr8-burn-omat-2.0.1";
+
+  src = args.fetchurl {
+    url = http://avr8-burn-o-mat.brischalle.de/AVR8_Burn-O-Mat_2_0_1.zip;
+    sha256 = "0nqlrbsx7z5r3b9y9wb6b7wawa3yxwx07zn7l4g4s59scxah2skk";
+  };
+
+  buildInputs =(with args; [unzip]);
+
+  phases = "unpackPhase installPhase";
+
+
+  # move to nix-support to not create that many symlinks..
+  # TODO burnomat tries to read /usr/local/etc/avrdude.conf (but you can edit it within the settings dialog)
+  installPhase = ''
+    ensureDir $out/{nix-support,bin}
+    mv *.jar license_gpl-3.0.txt lib *.xml *.png $out/nix-support
+    cat >> $out/bin/avr8-burn-omat << EOF
+      #!/bin/sh
+      cd $out/nix-support; exec java -jar AVR8_Burn_O_Mat.jar
+    EOF
+    chmod +x $out/bin/avr8-burn-omat
+  '';
+
+  meta = { 
+      description = "gui tool for avrdude (nice to set fuse bits)";
+      homepage = http://avr8-burn-o-mat.brischalle.de/avr8_burn_o_mat_avrdude_gui_en.html;
+      license = "GPLv3";
+  };
+}
diff --git a/pkgs/development/misc/bleeding-edge-repos/default.nix b/pkgs/development/misc/bleeding-edge-repos/default.nix
index dade5b3e94bd..846788aca90f 100644
--- a/pkgs/development/misc/bleeding-edge-repos/default.nix
+++ b/pkgs/development/misc/bleeding-edge-repos/default.nix
@@ -23,7 +23,7 @@ args:
         then localTarGZ else fetchinfo;
 
   repos = 
-      let kde4support = builtins.listToAttrs (map (n: lib.nv ("kdesupport_"+n) { type = "svn"; url = "svn://anonsvn.kde.org/home/kde/trunk/kdesupport/${n}"; groups="kdesupport"; })
+      let kde4support = builtins.listToAttrs (map (n: lib.nameValuePair ("kdesupport_"+n) { type = "svn"; url = "svn://anonsvn.kde.org/home/kde/trunk/kdesupport/${n}"; groups="kdesupport"; })
                           [ "akode" "eigen" "gmm" "qca" "qimageblitz" "soprano" "strigi" "taglib" 
                           "automoc" "akonadi" "cpptoxml" "decibel" "emerge" "phonon" "tapioca_qt" "telepathy_qt"]); in
       # in trunk but not yet supported by nix: akonadi/ automoc/ cpptoxml/ decibel/ emerge/ kdewin-installer/ kdewin32/ phonon/ tapioca-qt/ telepathy-qt/
diff --git a/pkgs/development/perl-modules/Compress-Raw-Bzip2/default.nix b/pkgs/development/perl-modules/Compress-Raw-Bzip2/default.nix
new file mode 100644
index 000000000000..b0e2ec7d2b1a
--- /dev/null
+++ b/pkgs/development/perl-modules/Compress-Raw-Bzip2/default.nix
@@ -0,0 +1,15 @@
+{fetchurl, buildPerlPackage, bzip2}:
+
+buildPerlPackage rec {
+  name = "Compress-Raw-Bzip2-2.015";
+    
+  src = fetchurl {
+    url = "mirror://cpan/authors/id/P/PM/PMQS/${name}.tar.gz";
+    sha256 = "0rc49w7i552j89ws85h7s1bzvs17m065lgy3mj23h0gplkbjnwkp";
+  };
+
+  # Don't build a private copy of bzip2.
+  BUILD_BZIP2 = false;
+  BZIP2_LIB = "${bzip2}/lib";
+  BZIP2_INCLUDE = "${bzip2}/include";
+}
diff --git a/pkgs/development/perl-modules/catalyst-fix-chunked-encoding.patch b/pkgs/development/perl-modules/catalyst-fix-chunked-encoding.patch
new file mode 100644
index 000000000000..7822128f8467
--- /dev/null
+++ b/pkgs/development/perl-modules/catalyst-fix-chunked-encoding.patch
@@ -0,0 +1,23 @@
+diff -rc Catalyst-Engine-HTTP-Prefork-0.50-orig/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm Catalyst-Engine-HTTP-Prefork-0.50/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm
+*** Catalyst-Engine-HTTP-Prefork-0.50-orig/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm	2008-03-14 18:23:47.000000000 +0100
+--- Catalyst-Engine-HTTP-Prefork-0.50/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm	2009-03-11 14:18:40.000000000 +0100
+***************
+*** 199,206 ****
+      
+      if ( $self->{_chunked_res} ) {
+          if ( !$self->{_chunked_done} ) {
+!             # Write the final '0' chunk
+!             syswrite STDOUT, "0$CRLF";
+          }
+          
+          delete $self->{_chunked_res};
+--- 199,207 ----
+      
+      if ( $self->{_chunked_res} ) {
+          if ( !$self->{_chunked_done} ) {
+!             # Write the final '0' chunk and the CRLF that terminates
+!             # the chunked body.
+!             syswrite STDOUT, "0$CRLF$CRLF";
+          }
+          
+          delete $self->{_chunked_res};
diff --git a/pkgs/development/python-modules/pycups/default.nix b/pkgs/development/python-modules/pycups/default.nix
new file mode 100644
index 000000000000..ef36ec5d0700
--- /dev/null
+++ b/pkgs/development/python-modules/pycups/default.nix
@@ -0,0 +1,11 @@
+{stdenv, fetchurl, python, cups}:
+
+stdenv.mkDerivation {
+  name = "pycups-1.9.45";
+  src = fetchurl {
+    url = http://cyberelk.net/tim/data/pycups/pycups-1.9.45.tar.bz2;
+    md5 = "ff634a6751f8a859ed26751bf03abef0";
+  };
+  installPhase = "python ./setup.py install --prefix $out";
+  buildInputs = [ python cups ];
+}
diff --git a/pkgs/development/python-modules/pygame/default.nix b/pkgs/development/python-modules/pygame/default.nix
index e0a09d94d7f0..347501f8a5b7 100644
--- a/pkgs/development/python-modules/pygame/default.nix
+++ b/pkgs/development/python-modules/pygame/default.nix
@@ -41,8 +41,6 @@ stdenv.mkDerivation {
   installPhase = "yes Y | python setup.py install --prefix=\${out} ";
 
   meta = {
-    description = "
-	Python library for games.
-";
+    description = "Python library for games";
   };
 }
diff --git a/pkgs/development/python-modules/pyqt/default.nix b/pkgs/development/python-modules/pyqt/default.nix
new file mode 100644
index 000000000000..deba647c6624
--- /dev/null
+++ b/pkgs/development/python-modules/pyqt/default.nix
@@ -0,0 +1,11 @@
+{stdenv, fetchurl, python, sip, qt4}:
+
+stdenv.mkDerivation {
+  name = "pyqt-x11-gpl-4.4.4";
+  src = fetchurl {
+    url = http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4/PyQt-x11-gpl-4.4.4.tar.gz;
+    md5 = "4bd346d56d10452e47ac71e2cbe04229";
+  };
+  configurePhase = "python ./configure.py --confirm-license -b $out/bin -d $out/lib/python2.5/site-packages -v $out/share/sip -p $out/plugins";
+  buildInputs = [ python sip qt4 ];
+}
diff --git a/pkgs/development/python-modules/python-sip/default.nix b/pkgs/development/python-modules/python-sip/default.nix
new file mode 100644
index 000000000000..4dca67cd3f77
--- /dev/null
+++ b/pkgs/development/python-modules/python-sip/default.nix
@@ -0,0 +1,11 @@
+{stdenv, fetchurl, python}:
+
+stdenv.mkDerivation {
+  name = "sip-4.7.9";
+  src = fetchurl {
+    url = http://www.riverbankcomputing.co.uk/static/Downloads/sip4/sip-4.7.9.tar.gz;
+    md5 = "597d7ff7edb42a18421c806ffd18a136";
+  };
+  configurePhase = "python ./configure.py -d $out/lib/python2.5/site-packages -b $out/bin -e $out/include";
+  buildInputs = [ python ];
+}
diff --git a/pkgs/development/python-modules/pyxml/default.nix b/pkgs/development/python-modules/pyxml/default.nix
index 7c9aafded73d..3c36565b5266 100644
--- a/pkgs/development/python-modules/pyxml/default.nix
+++ b/pkgs/development/python-modules/pyxml/default.nix
@@ -22,8 +22,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = {
-    description = ''The PyXML package is a collection of libraries to process
-                    XML with Python.'';
+    description = "A collection of libraries to process XML with Python";
     homepage = http://pyxml.sourceforge.net/;
   };
 }
diff --git a/pkgs/development/python-modules/rhpl/builder.sh b/pkgs/development/python-modules/rhpl/builder.sh
new file mode 100644
index 000000000000..d458500b4efb
--- /dev/null
+++ b/pkgs/development/python-modules/rhpl/builder.sh
@@ -0,0 +1,12 @@
+source $stdenv/setup
+
+rpm2cpio $src | cpio -idv
+tar xfvj rhpl-*.tar.bz2
+rm rhpl-*.tar.bz2
+cd rhpl-*
+sed -i -e "s@/usr/include/\$(PYTHON)@$python/include/python2.5@" \
+       -e "s@PYTHONLIBDIR = /usr/\$(LIBDIR)/\$(PYTHON)/site-packages@PYTHONLIBDIR = $out/lib/python2.5/site-packages@" Makefile.inc
+sed -i -e "s@/usr/bin/install@install@g" \
+       -e "s@\$(DESTDIR)/usr/share/locale@$out/share/locale@" po/Makefile       
+make PREFIX=$out
+make PREFIX=$out install
diff --git a/pkgs/development/python-modules/rhpl/default.nix b/pkgs/development/python-modules/rhpl/default.nix
new file mode 100644
index 000000000000..a577d3ac7b97
--- /dev/null
+++ b/pkgs/development/python-modules/rhpl/default.nix
@@ -0,0 +1,12 @@
+{stdenv, fetchurl, rpm, cpio, python, wirelesstools, gettext}:
+
+stdenv.mkDerivation {
+  name = "rhpl-0.218";
+  src = fetchurl {
+    url = http://ftp.stw-bonn.de/pub/fedora/linux/releases/10/Everything/source/SRPMS/rhpl-0.218-1.src.rpm;
+    md5 = "a72c6b66df782ca1d4950959d2aad292";
+  };
+  inherit python;
+  builder = ./builder.sh;
+  buildInputs = [ rpm cpio python wirelesstools gettext ];
+}
diff --git a/pkgs/tools/text/py-string-template/default.nix b/pkgs/development/python-modules/stringtemplate/default.nix
index 0ca503a16ac4..f70888f102fc 100644
--- a/pkgs/tools/text/py-string-template/default.nix
+++ b/pkgs/development/python-modules/stringtemplate/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, python}:
+{stdenv, fetchurl, python, antlr}:
 
 stdenv.mkDerivation rec {
   name = "PyStringTemplate-${version}";
@@ -8,10 +8,10 @@ stdenv.mkDerivation rec {
     description = "Text Templating Library";
   };
   src = fetchurl {
-    url = "http://www.stringtemplate.org/download/PyStringTemplate-3.2b1.tar.gz";
+    url = "http://www.stringtemplate.org/download/${name}.tar.gz";
     sha256 = "0lbib0l8c1q7i1j610rwcdagymr1idahrql4dkgnm5rzyg2vk3ml";
   };
-  propagatedBuildInputs = [python];
+  propagatedBuildInputs = [python antlr];
   buildPhase = "true";
   installPhase = "python setup.py install --prefix=$out --install-lib=$(toPythonPath $out) -O1";
 }
diff --git a/pkgs/development/tools/analysis/valgrind/default.nix b/pkgs/development/tools/analysis/valgrind/default.nix
index 2ec5b2bd795c..357e2eb65971 100644
--- a/pkgs/development/tools/analysis/valgrind/default.nix
+++ b/pkgs/development/tools/analysis/valgrind/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, perl, gdb }:
 
-stdenv.mkDerivation {
-  name = "valgrind-3.4.0";
+stdenv.mkDerivation rec {
+  name = "valgrind-3.4.1";
 
   src = fetchurl {
-    url = http://valgrind.org/downloads/valgrind-3.4.0.tar.bz2;
-    sha256 = "0x4zbwk9ml3kbjzwh887ahw0pdxcm5h9159qg9kwm7zgn7jlmsnm";
+    url = "http://valgrind.org/downloads/${name}.tar.bz2";
+    sha256 = "1ac465lh0b61q46xjrvs9ld1x4fk6nzdgdjr0590bad3p2mfg7k6";
   };
 
   # Perl is needed for `cg_annotate'.
diff --git a/pkgs/development/tools/build-managers/cmake/2.6.3.nix b/pkgs/development/tools/build-managers/cmake/2.6.3.nix
new file mode 100644
index 000000000000..bb9c3b1485f9
--- /dev/null
+++ b/pkgs/development/tools/build-managers/cmake/2.6.3.nix
@@ -0,0 +1,31 @@
+{fetchurl, stdenv, replace, ncurses}:
+
+stdenv.mkDerivation rec {
+  name = "cmake-2.6.3-RC-15";
+
+  # We look for cmake modules in .../share/cmake-${majorVersion}/Modules.
+  majorVersion = "2.6";
+
+  setupHook = ./setup-hook.sh;
+
+  meta = {
+    homepage = http://www.cmake.org/;
+    description = "Cross-Platform Makefile Generator";
+  };
+
+  src = fetchurl {
+    url = "http://www.cmake.org/files/v2.6/${name}.tar.gz";
+    sha256 = "476b6daca63c39bc46955f99f2566735d51159c43ccc716fa689ba2a2fa7e432";
+  };
+
+  postUnpack = ''
+    dontUseCmakeConfigure=1
+    source $setupHook
+    fixCmakeFiles $sourceRoot
+    echo 'SET (CMAKE_SYSTEM_PREFIX_PATH "'${ncurses}'" CACHE FILEPATH "Root for libs for cmake" FORCE)' > $sourceRoot/cmakeInit.txt
+  '';
+
+  configureFlags= [ " --init=cmakeInit.txt " ];
+
+  postInstall = "fixCmakeFiles $out/share";
+}
diff --git a/pkgs/development/tools/build-managers/cmake/default.nix b/pkgs/development/tools/build-managers/cmake/default.nix
index 171a44d37332..f46ba5ce9aa5 100644
--- a/pkgs/development/tools/build-managers/cmake/default.nix
+++ b/pkgs/development/tools/build-managers/cmake/default.nix
@@ -2,20 +2,30 @@
 
 stdenv.mkDerivation rec {
   name = "cmake-2.6.2";
+
+  # We look for cmake modules in .../share/cmake-${majorVersion}/Modules.
+  majorVersion = "2.6"; 
+  
   setupHook = ./setup-hook.sh;
+  
   meta = {
+    homepage = http://www.cmake.org/;
     description = "Cross-Platform Makefile Generator";
   };
+  
   src = fetchurl {
     url = "http://www.cmake.org/files/v2.6/${name}.tar.gz";
     sha256 = "b3f5a9dfa97fb82cb1b7d78a62d949f93c8d4317af36674f337d27066fa6b7e9";
   };
-  inherit ncurses;
-  propagatedBuildInputs = [replace];
-  postUnpack = "
-    source \${setupHook}; fixCmakeFiles \${sourceRoot};
-    echo 'SET (CMAKE_SYSTEM_PREFIX_PATH \"'\${ncurses}'\" CACHE FILEPATH \"Root for libs for cmake\" FORCE)' > \${sourceRoot}/cmakeInit.txt
-  ";
+  
+  postUnpack = ''
+    dontUseCmakeConfigure=1
+    source $setupHook
+    fixCmakeFiles $sourceRoot
+    echo 'SET (CMAKE_SYSTEM_PREFIX_PATH "'${ncurses}'" CACHE FILEPATH "Root for libs for cmake" FORCE)' > $sourceRoot/cmakeInit.txt
+  '';
+  
   configureFlags= [ " --init=cmakeInit.txt " ];
-  postInstall="fixCmakeFiles \$out/share";
+  
+  postInstall = "fixCmakeFiles $out/share";
 }
diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
index 2ec77d8223e3..c289272d2a78 100755
--- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
@@ -1,49 +1,46 @@
-addCMakeParamsInclude()
+addCMakeParams()
 {
     addToSearchPath CMAKE_INCLUDE_PATH /include "" $1
-}
-
-addCMakeParamsLibs()
-{
     addToSearchPath CMAKE_LIBRARY_PATH /lib "" $1
-}
-
-addCMakeModulePath()
-{
-    addToSearchPath CMAKE_MODULE_PATH /share/cmake-2.4/Modules "" $1
+    addToSearchPath CMAKE_MODULE_PATH /share/cmake-@majorVersion@/Modules "" $1
 }
 
 fixCmakeFiles()
 {
-    local replaceArgs;
-    echo "Fixing cmake files"
+    local replaceArgs
+    echo "fixing cmake files"
     replaceArgs="-e -f -L -T /usr /FOO"
-    replaceArgs="${replaceArgs}     -a NO_DEFAULT_PATH \"\" -a NO_SYSTEM_PATH \"\""
+    replaceArgs="$replaceArgs -a NO_DEFAULT_PATH \"\" -a NO_SYSTEM_PATH \"\""
     find $1 -type f -name "*.cmake" | xargs replace-literal ${replaceArgs}
 }
 
-cmakePostUnpack()
+cmakeConfigurePhase()
 {
-    sourceRoot=$sourceRoot/build
-    mkdir -v $sourceRoot
-    echo source root reset to $sourceRoot
-
-    if [ -z "$dontFixCmake" ]; then
+    eval "$preConfigure"
+    
+    if test -z "$dontFixCmake"; then
         fixCmakeFiles .
     fi
 
-    if [ -z "$configureScript" ]; then
-        configureScript="cmake .."
+    if test -z "$dontUseCmakeBuildDir"; then
+        mkdir -p build
+        cd build
+        cmakeDir=..
     fi
-    if [ -z "$dontAddPrefix" ]; then
-        dontAddPrefix=1
-        configureFlags="-DCMAKE_INSTALL_PREFIX=$out $configureFlags"
+
+    if test -z "$dontAddPrefix"; then
+        cmakeFlags="-DCMAKE_INSTALL_PREFIX=$prefix $cmakeFlags"
     fi
-}
 
+    echo "cmake flags: $cmakeFlags ${cmakeFlagsArray[@]}"
+    
+    cmake ${cmakeDir:-.} $cmakeFlags ${cmakeFlagsArray[@]}
+    
+    eval "$postConfigure"
+}
 
-if [ -z "$noCmakeTewaks" ]; then
-    postUnpack="cmakePostUnpack${postUnpack:+; }${postUnpack}"
-fi;
+if test -z "$dontUseCmakeConfigure"; then
+    configurePhase=cmakeConfigurePhase
+fi
 
-envHooks=(${envHooks[@]} addCMakeParamsInclude addCMakeParamsLibs addCMakeModulePath)
+envHooks=(${envHooks[@]} addCMakeParams)
diff --git a/pkgs/development/tools/documentation/doxygen/default.nix b/pkgs/development/tools/documentation/doxygen/default.nix
index e5a91ec6b01b..de05ba2d1439 100644
--- a/pkgs/development/tools/documentation/doxygen/default.nix
+++ b/pkgs/development/tools/documentation/doxygen/default.nix
@@ -1,15 +1,46 @@
 {stdenv, fetchurl, graphviz, perl, flex, bison, gnumake, libX11, libXext, qt}:
 
 stdenv.mkDerivation rec {
-  name = "doxygen-1.5.7.1";
+  name = "doxygen-1.5.8";
+
   src = fetchurl {
     url = "ftp://ftp.stack.nl/pub/users/dimitri/${name}.src.tar.gz";
-    sha256 = "0abds9d2ff4476105myl4933q6l4vqyyyajx6qial88iffbczsbw";
+    sha256 = "1y2gyijhknam51jyh5ja2z5hlj0mr7r328rrwf27g7ljgsphlm01";
   };
-  buildInputs = [graphviz perl flex bison libX11 libXext qt];
+
+  patches = [ ./tmake.patch ];
+
+  buildInputs = [ graphviz perl flex bison libX11 libXext ]
+    ++ (if qt != null then [ qt ] else []);
+
   prefixKey = "--prefix ";
   configureFlags = "--release"
-		 + " --make ${gnumake}/bin/make"
 		 + (if qt == null then "" else " --with-doxywizard")
 		 ;
+
+  preConfigure =
+   (if qt == null
+    then ""
+    else ''
+      echo "using QTDIR=${qt}..."
+      export QTDIR=${qt}
+    '');
+      # export CPLUS_INCLUDE_PATH="${qt}/include:$CPLUS_INCLUDE_PATH"
+      # export LIBRARY_PATH="${qt}/lib:$LIBRARY_PATH"
+
+  meta = {
+    description = "Doxygen, a source code documentation generator tool";
+
+    longDescription = ''
+      Doxygen is a documentation system for C++, C, Java, Objective-C,
+      Python, IDL (CORBA and Microsoft flavors), Fortran, VHDL, PHP,
+      C\#, and to some extent D.  It can generate an on-line
+      documentation browser (in HTML) and/or an off-line reference
+      manual (in LaTeX) from a set of documented source files.
+    '';
+
+    homepage = http://doxygen.org/;
+
+    license = "GPLv2+";
+  };
 }
diff --git a/pkgs/development/tools/documentation/doxygen/tmake.patch b/pkgs/development/tools/documentation/doxygen/tmake.patch
new file mode 100644
index 000000000000..4bba986c12c9
--- /dev/null
+++ b/pkgs/development/tools/documentation/doxygen/tmake.patch
@@ -0,0 +1,23 @@
+Fix the `check_unix' function, which looks for `/bin/uname' to determine
+whether we're on a Unix-like system.
+
+--- doxygen-1.5.8/tmake/bin/tmake	2008-12-06 14:16:20.000000000 +0100
++++ doxygen-1.5.8/tmake/bin/tmake	2009-03-05 11:29:55.000000000 +0100
+@@ -234,17 +234,7 @@ sub tmake_verb {
+ #
+ 
+ sub check_unix {
+-    my($r);
+-    $r = 0;
+-    if ( -f "/bin/uname" ) {
+-	$r = 1;
+-	(-f "\\bin\\uname") && ($r = 0);
+-    }
+-    if ( -f "/usr/bin/uname" ) {
+-	$r = 1;
+-	(-f "\\usr\\bin\\uname") && ($r = 0);
+-    }
+-    return $r;
++    return 1;
+ }
+ 
diff --git a/pkgs/development/tools/guile/g-wrap/default.nix b/pkgs/development/tools/guile/g-wrap/default.nix
index 01a1dbe72eb6..3efabbf99860 100644
--- a/pkgs/development/tools/guile/g-wrap/default.nix
+++ b/pkgs/development/tools/guile/g-wrap/default.nix
@@ -2,10 +2,10 @@
 , guileLib }:
 
 stdenv.mkDerivation rec {
-  name = "g-wrap-1.9.11";
+  name = "g-wrap-1.9.12";
   src = fetchurl {
     url = "mirror://savannah/g-wrap/${name}.tar.gz";
-    sha256 = "1j8zchilsr0dziyr21az4x3xxyr4d3jc8nybag9rp6pjj8k49adn";
+    sha256 = "1bkca6vj92phgk46n1qid6naxgx58kk4p1y29pap6177j81s7cc6";
   };
 
   # Note: Glib support is optional, but it's quite useful (e.g., it's
diff --git a/pkgs/development/tools/guile/guile-lint/default.nix b/pkgs/development/tools/guile/guile-lint/default.nix
index d2e4f7c25108..18625a3ec313 100644
--- a/pkgs/development/tools/guile/guile-lint/default.nix
+++ b/pkgs/development/tools/guile/guile-lint/default.nix
@@ -20,8 +20,7 @@ stdenv.mkDerivation rec {
   doCheck = true;
 
   meta = {
-    description = ''Guile-Lint checks syntax and semantics in a
-                    Guile program or module.'';
+    description = "Guile-Lint checks syntax and semantics in a Guile program or module";
     homepage = http://www.geocities.com/user42_kevin/guile-lint/index.html;
     license = "GPL";
   };
diff --git a/pkgs/development/tools/misc/avrdude/default.nix b/pkgs/development/tools/misc/avrdude/default.nix
index 38871c8fd4c5..ce2d36bebe80 100644
--- a/pkgs/development/tools/misc/avrdude/default.nix
+++ b/pkgs/development/tools/misc/avrdude/default.nix
@@ -1,32 +1,30 @@
 args: with args;
 let edf = composableDerivation.edf; in
-composableDerivation.composableDerivation {
-  initial = {
-    name="avrdude-5.4";
+composableDerivation.composableDerivation {} {
+  name="avrdude-5.4";
 
-    src = fetchurl {
-        url = http://mirror.switch.ch/mirror/gentoo/distfiles/avrdude-5.4.tar.gz;
-        sha256 = "bee4148c51ec95999d803cb9f68f12ac2e9128b06f07afe307d38966c0833b30";
-    };
+  src = fetchurl {
+      url = http://mirror.switch.ch/mirror/gentoo/distfiles/avrdude-5.4.tar.gz;
+      sha256 = "bee4148c51ec95999d803cb9f68f12ac2e9128b06f07afe307d38966c0833b30";
+  };
 
-    configureFlags = [ "--disable-dependency-tracking" ];
+  configureFlags = [ "--disable-dependency-tracking" ];
 
-    buildInputs = [yacc flex];
+  buildInputs = [yacc flex];
 
-    flags =
-           edf { name = "doc"; enable = { buildInputs = texLive;  configureFlags = ["--enable-doc"]; }; }
-        // edf { name = "parport"; }
-        ;
+  flags =
+         edf { name = "doc"; enable = { buildInputs = texLive;  configureFlags = ["--enable-doc"]; }; }
+      // edf { name = "parport"; }
+      ;
 
-    cfg = {
-      docSupport = false; # untested
-      parportSupport = true;
-    };
+  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/development/tools/misc/indent/2.2.9.nix b/pkgs/development/tools/misc/indent/2.2.9.nix
index 3fefc259b39f..a3d800c81e98 100644
--- a/pkgs/development/tools/misc/indent/2.2.9.nix
+++ b/pkgs/development/tools/misc/indent/2.2.9.nix
@@ -22,9 +22,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure preBuild doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	GNU Indent - a source text formatter.
-";
+		description = "GNU Indent - a source text formatter";
 		inherit src;
 	};
 }
diff --git a/pkgs/development/tools/misc/ltrace/0.5-3deb.nix b/pkgs/development/tools/misc/ltrace/0.5-3deb.nix
index 8dde78d516bc..d462cc3ab392 100644
--- a/pkgs/development/tools/misc/ltrace/0.5-3deb.nix
+++ b/pkgs/development/tools/misc/ltrace/0.5-3deb.nix
@@ -29,9 +29,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [preBuild preConfigure doConfigure doMakeInstall doForceShare]);
 	meta = {
-		description = "
-	Library call tracer.
-";
+		description = "Library call tracer";
 		inherit src;
 	};
 }
diff --git a/pkgs/development/tools/misc/sloccount/default.nix b/pkgs/development/tools/misc/sloccount/default.nix
new file mode 100644
index 000000000000..b25313f43558
--- /dev/null
+++ b/pkgs/development/tools/misc/sloccount/default.nix
@@ -0,0 +1,51 @@
+{ fetchurl, stdenv, perl }:
+
+stdenv.mkDerivation rec {
+  name = "sloccount-2.26";
+
+  src = fetchurl {
+    url = "http://www.dwheeler.com/sloccount/${name}.tar.gz";
+    sha256 = "0ayiwfjdh1946asah861ah9269s5xkc8p5fv1wnxs9znyaxs4zzs";
+  };
+
+  buildInputs = [ perl ];
+
+  patchPhase = ''
+    for file in *
+    do
+      substituteInPlace "$file" --replace "/usr/bin/perl" "${perl}/bin/perl"
+    done
+  '';
+
+  configurePhase = ''
+    sed -i "makefile" -"es|PREFIX[[:blank:]]*=.*$|PREFIX = $out|g"
+  '';
+
+  doCheck = true;
+  checkPhase = ''HOME="$TMPDIR" PATH="$PWD:$PATH" make test'';
+
+  preInstall = ''
+    ensureDir "$out/bin"
+    ensureDir "$out/share/man/man1"
+    ensureDir "$out/share/doc"
+  '';
+
+  meta = {
+    description = "SLOCCount, a set of tools for counting physical Source Lines of Code (SLOC)";
+
+    longDescription = ''
+      This is the home page of "SLOCCount", a set of tools for
+      counting physical Source Lines of Code (SLOC) in a large number
+      of languages of a potentially large set of programs.  This suite
+      of tools was used in my papers More than a Gigabuck: Estimating
+      GNU/Linux's Size and Estimating Linux's Size to measure the SLOC
+      of entire GNU/Linux distributions, and my essay Linux Kernel
+      2.6: It's Worth More!  Others have measured Debian GNU/Linux and
+      the Perl CPAN library using this tool suite.
+    '';
+
+    license = "GPLv2+";
+
+    homepage = http://www.dwheeler.com/sloccount/;
+  };
+}
diff --git a/pkgs/development/tools/parsing/antlr/antlr-2.7.6.nix b/pkgs/development/tools/parsing/antlr/antlr-2.7.6.nix
index 43151ba589af..baadc510f89f 100644
--- a/pkgs/development/tools/parsing/antlr/antlr-2.7.6.nix
+++ b/pkgs/development/tools/parsing/antlr/antlr-2.7.6.nix
@@ -1,11 +1,10 @@
-{stdenv, fetchurl, jre}:
+{stdenv, fetchurl, jdk, python}:
 
 stdenv.mkDerivation {
   name = "antlr-2.7.6";
-  builder = ./builder2.sh;
   src = fetchurl {
     url = http://www.antlr.org/download/antlr-2.7.6.tar.gz;
     md5 = "17d8bf2e814f0a26631aadbbda8d7324";
   };
-  inherit jre;
+  buildInputs = [jdk python];
 }
diff --git a/pkgs/development/tools/parsing/antlr/builder2.sh b/pkgs/development/tools/parsing/antlr/builder2.sh
deleted file mode 100644
index 75477393aa22..000000000000
--- a/pkgs/development/tools/parsing/antlr/builder2.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-source $stdenv/setup
-
-tar zxvf $src
-cd antlr-*
-
-ensureDir $out/bin
-ensureDir $out/lib/$name
-
-cp antlr.jar $out/lib/$name
-
-cat > $out/bin/antlr <<EOF
-#! $SHELL
-$jre/bin/java -cp $out/lib/$name/antlr.jar -Xms200M -Xmx400M antlr.Tool \$*
-EOF
-
-chmod u+x $out/bin/antlr
diff --git a/pkgs/development/tools/parsing/ragel/default.nix b/pkgs/development/tools/parsing/ragel/default.nix
index f60d32f09ea2..2dec606254b4 100644
--- a/pkgs/development/tools/parsing/ragel/default.nix
+++ b/pkgs/development/tools/parsing/ragel/default.nix
@@ -5,40 +5,38 @@ let
   name = "ragel-${version}";
 in
 
-composableDerivation.composableDerivation {
-  initial = rec {
-    inherit name;
-    src = fetchurl {
-      url = "http://www.complang.org/ragel/${name}.tar.gz";
-      sha256 = "018cedc8a68be85cda330fc53d0bb8a1ca6ad39b1cf790eed0311e7baa5a2520";
-    };
+composableDerivation.composableDerivation {} {
+  inherit name;
+  src = fetchurl {
+    url = "http://www.complang.org/ragel/${name}.tar.gz";
+    sha256 = "018cedc8a68be85cda330fc53d0bb8a1ca6ad39b1cf790eed0311e7baa5a2520";
+  };
 
-    flags = {
-      doc = {
-        # require fig2dev & pdflatex (see README)
-        buildInputs = [transfig texLive];
-        # use post* because default values of buildPhase is empty.
-        postBuild = ''
-          pushd doc
-          make
-          popd
-        '';
-        postInstall = ''
-          pushd doc
-          make install
-          popd
-        '';
-      };
+  flags = {
+    doc = {
+      # require fig2dev & pdflatex (see README)
+      buildInputs = [transfig texLive];
+      # use post* because default values of buildPhase is empty.
+      postBuild = ''
+        pushd doc
+        make
+        popd
+      '';
+      postInstall = ''
+        pushd doc
+        make install
+        popd
+      '';
     };
+  };
 
-    cfg = {
-      docSupport = false;
-    };
+  cfg = {
+    docSupport = false;
+  };
 
-    meta = {
-      homepage = http://www.complang.org/ragel;
-      description = "State machine compiler";
-      license = "GPL-2";
-    };
+  meta = {
+    homepage = http://www.complang.org/ragel;
+    description = "State machine compiler";
+    license = "GPL-2";
   };
 }
diff --git a/pkgs/games/construo/0.2.2.nix b/pkgs/games/construo/0.2.2.nix
index e0447382e56f..bd6e95b9cb2f 100644
--- a/pkgs/games/construo/0.2.2.nix
+++ b/pkgs/games/construo/0.2.2.nix
@@ -23,9 +23,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [preConfigure doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	Construo masses and springs simulation.
-";
+		description = "Construo masses and springs simulation";
 		inherit src;
 	};
 }
diff --git a/pkgs/games/extremetuxracer/default.nix b/pkgs/games/extremetuxracer/default.nix
new file mode 100644
index 000000000000..6aad901d58c6
--- /dev/null
+++ b/pkgs/games/extremetuxracer/default.nix
@@ -0,0 +1,31 @@
+a :  
+let 
+  fetchurl = a.fetchurl;
+
+  version = a.lib.getAttr ["version"] "0.5beta" a; 
+  buildInputs = with a; [
+    mesa libX11 xproto tcl freeglut
+    SDL SDL_mixer libXi inputproto
+    libXmu libXext xextproto libXt libSM libICE
+    libpng pkgconfig gettext intltool
+  ];
+in
+rec {
+  src = fetchurl {
+    url = "http://downloads.sourceforge.net/extremetuxracer/extremetuxracer-${version}.tar.gz";
+    sha256 = "04d99fsfna5mc9apjxsiyw0zgnswy33kwmm1s9d03ihw6rba2zxs";
+  };
+
+  inherit buildInputs;
+  configureFlags = [
+  		"--with-tcl=${a.tcl}/lib"
+  	];
+
+  /* doConfigure should be removed if not needed */
+  phaseNames = ["doConfigure" "doMakeInstall"];
+
+  name = "extremetuxracer-" + version;
+  meta = {
+    description = "ExtremeTuxRacer - Tux lies on his belly and accelerates down ice slopes..";
+  };
+}
diff --git a/pkgs/games/fsg/alt-builder.nix b/pkgs/games/fsg/alt-builder.nix
index da0c127a6e74..dfc7c6c724eb 100644
--- a/pkgs/games/fsg/alt-builder.nix
+++ b/pkgs/games/fsg/alt-builder.nix
@@ -28,9 +28,7 @@ stdenv.mkDerivation {
 		(textClosure localDefs [doUnpack addInputs preBuild doMake installPhase doForceShare]);
 
   meta = {
-    description = "
-	Falling Sand Game - a cellular automata engine tuned towards the likes of Falling Sand.
-";
-		inherit src;
+    description = "Falling Sand Game - a cellular automata engine tuned towards the likes of Falling Sand";
+    inherit src;
   };
 }
diff --git a/pkgs/games/fsg/default.nix b/pkgs/games/fsg/default.nix
index 891ac488bf38..b67b1bcfc5f8 100644
--- a/pkgs/games/fsg/default.nix
+++ b/pkgs/games/fsg/default.nix
@@ -1,14 +1,14 @@
 args: with args;
+
 stdenv.mkDerivation {
   name = "fsg-4.4";
 
-  src = 
-	fetchurl {
-		url = http://www.piettes.com/fallingsandgame/fsg-src-4.4.tar.gz;
-		sha256 = "1756y01rkvd3f1pkj88jqh83fqcfl2fy0c48mcq53pjzln9ycv8c";
-	};
+  src = fetchurl {
+    url = http://www.piettes.com/fallingsandgame/fsg-src-4.4.tar.gz;
+    sha256 = "1756y01rkvd3f1pkj88jqh83fqcfl2fy0c48mcq53pjzln9ycv8c";
+  };
 
-  buildInputs =[gtk glib pkgconfig mesa (wxGTK null) libX11 xproto];
+  buildInputs = [gtk glib pkgconfig mesa (wxGTK null) libX11 xproto];
 
 /*  
 #	One day Unicode will overcome?
@@ -29,22 +29,20 @@ stdenv.mkDerivation {
 		cp -r . /tmp/fsg
 	";*/
 
-	preBuild = "
-		sed -e '
-		s@currentProbIndex != 100@0@;
-		' -i MainFrame.cpp;
-	";
+  preBuild = ''
+    sed -e '
+      s@currentProbIndex != 100@0@;
+    ' -i MainFrame.cpp
+  '';
 
-  installPhase = "
-		ensureDir \$out/bin \$out/libexec;
-		cp sand \$out/libexec;
-		echo -e '#! /bin/sh\nLC_ALL=C '\$out'/libexec/sand \"$@\"' >\$out/bin/fsg;
-		chmod a+x \$out/bin/fsg;
-	";
+  installPhase = ''
+    ensureDir $out/bin $out/libexec
+    cp sand $out/libexec
+    echo -e '#! /bin/sh\nLC_ALL=C '$out'/libexec/sand "$@"' >$out/bin/fsg
+    chmod a+x $out/bin/fsg
+  '';
 
   meta = {
-    description = "
-	Falling Sand Game - a cellular automata engine tuned towards the likes of Falling Sand.
-";
+    description = "Falling Sand Game - a cellular automata engine tuned towards the likes of Falling Sand";
   };
 }
diff --git a/pkgs/games/gemrb/default.nix b/pkgs/games/gemrb/default.nix
index 46ab9abe7460..aaccc8b5171b 100644
--- a/pkgs/games/gemrb/default.nix
+++ b/pkgs/games/gemrb/default.nix
@@ -13,8 +13,7 @@ stdenv.mkDerivation {
   configureFlags = "--with-zlib=${zlib}";
 
   meta = {
-    description = "A reimplementation of the Infinity Engine "
-      + " (used by Baldur's Gate, Icewind Dale, Planescape: Torment, etc.)";
+    description = "A reimplementation of the Infinity Engine, used by games such as Baldur's Gate";
     homepage = http://gemrb.sourceforge.net/;
   };
 }
diff --git a/pkgs/games/neverball/default.nix b/pkgs/games/neverball/default.nix
new file mode 100644
index 000000000000..3e1d10b3acb7
--- /dev/null
+++ b/pkgs/games/neverball/default.nix
@@ -0,0 +1,33 @@
+{stdenv, fetchurl, SDL, mesa, libpng, libjpeg, SDL_ttf, libvorbis, gettext} :
+
+stdenv.mkDerivation {
+  name = "neverball-1.5.0";
+  src = fetchurl {
+    url = http://neverball.org/neverball-1.5.0.tar.gz;
+    sha256 = "8e6f6946cf2b08c13e4956a14f46d74c5a40735965f8fa876668c52d1877ec6a";
+  };
+
+  buildInputs = [ SDL mesa libpng libjpeg SDL_ttf libvorbis gettext ];
+
+  dontPatchElf = true;
+
+  patchPhase = ''
+    sed -i -e 's@\./data@'$out/data@ share/base_config.h
+    sed -i -e 's@\./locale@'$out/locale@ share/base_config.h
+    sed -i -e 's@-lvorbisfile@-lvorbisfile -lX11@' Makefile
+  '';
+
+  installPhase = ''
+    ensureDir $out/bin $out
+    cp -R data locale $out
+    cp neverball $out/bin
+    cp neverputt $out/bin
+    cp mapc $out/bin
+  '';
+
+  meta = {
+    homepage = http://neverball.org/;
+    description = "Tilt the floor to roll a ball";
+    license = "GPL";
+  };
+}
diff --git a/pkgs/games/orbit/1.01.nix b/pkgs/games/orbit/1.01.nix
index f128c7b90c2a..1d122643f658 100644
--- a/pkgs/games/orbit/1.01.nix
+++ b/pkgs/games/orbit/1.01.nix
@@ -35,9 +35,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[ customBuild doForceShare doPropagate]);
 	meta = {
-		description = "
-		Orbit space flight simulator.
-";
+		description = "Orbit space flight simulator";
 		inherit src;
 	};
 }
diff --git a/pkgs/games/scummvm/default.nix b/pkgs/games/scummvm/default.nix
index 458842ef317d..9a1eeb275c76 100644
--- a/pkgs/games/scummvm/default.nix
+++ b/pkgs/games/scummvm/default.nix
@@ -1,11 +1,11 @@
 {stdenv, fetchurl, SDL, zlib, mpeg2dec}:
 
 stdenv.mkDerivation {
-  name = "scummvm-0.12.0";
+  name = "scummvm-0.13.0";
   
   src = fetchurl {
-    url = mirror://sourceforge/scummvm/scummvm-0.12.0.tar.bz2;
-    sha256 = "16g6qgvlq2rp2q53spmc5li5y44aamr1hvz1v4wrdl28nsxs76nv";
+    url = mirror://sourceforge/scummvm/scummvm-0.13.0.tar.bz2;
+    sha256 = "0b82gpm596zggnm9d3gzji4xa12w1gbzariqi9hvk8mifpz6fliy";
   };
   
   buildInputs = [SDL zlib mpeg2dec];
diff --git a/pkgs/games/teeworlds/default.nix b/pkgs/games/teeworlds/default.nix
index 9e0bd2794d08..70852ff85bad 100644
--- a/pkgs/games/teeworlds/default.nix
+++ b/pkgs/games/teeworlds/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, python, alsaLib, libX11, mesa, SDL }:
 
 stdenv.mkDerivation rec {
-  name = "teeworlds-0.5.0";
+  name = "teeworlds-0.5.1";
 
   src = fetchurl {
     url = "http://www.teeworlds.com/files/${name}-src.tar.gz";
-    sha256 = "1akns8852j208cy3q4ki0fgbbpp0wyjm5fhnma7qs5k60321305x";
+    sha256 = "0y7yfb1n8rrcz8vcng9jch05sc5vl57nvjvd1x0mkm74ki1y6wpc";
   };
 
   # Note: Teeworlds requires Python 2.x to compile.  Python 3.0 will
diff --git a/pkgs/games/tuxracer/default.nix b/pkgs/games/tuxracer/default.nix
new file mode 100644
index 000000000000..9194bcdb1d5a
--- /dev/null
+++ b/pkgs/games/tuxracer/default.nix
@@ -0,0 +1,31 @@
+a :  
+let 
+  fetchurl = a.fetchurl;
+
+  version = a.lib.getAttr ["version"] "0.61" a; 
+  buildInputs = with a; [
+    mesa libX11 xproto tcl freeglut
+  ];
+in
+rec {
+  src = fetchurl {
+    url = "http://downloads.sourceforge.net/tuxracer/tuxracer-${version}.tar.gz";
+    sha256 = "1zqyz4ig0kax5q30vcgbavcjw36wsyp9yjsd2dbfb3srh28d04d3";
+  };
+
+  inherit buildInputs;
+  configureFlags = [];
+
+  /* doConfigure should be removed if not needed */
+  phaseNames = ["preConfigure" "doConfigure" "doMakeInstall"];
+
+  preConfigure = a.FullDepEntry (''
+    sed -e '/TCL_LIB_LIST=/atcl8.4' -i configure
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -DGLX_GLXEXT_LEGACY=1"
+  '') ["minInit" "doUnpack"];
+      
+  name = "tuxracer-" + version;
+  meta = {
+    description = "TuxRacer - Tux lies on his belly and accelerates down ice slopes..";
+  };
+}
diff --git a/pkgs/games/wesnoth/default.nix b/pkgs/games/wesnoth/default.nix
index 65c6002091e4..d82e29c4f1b2 100644
--- a/pkgs/games/wesnoth/default.nix
+++ b/pkgs/games/wesnoth/default.nix
@@ -1,5 +1,6 @@
 args: with args;
-stdenv.mkDerivation (rec {
+
+stdenv.mkDerivation rec {
   pname = "wesnoth";
   version = "1.4.1";
 
@@ -15,8 +16,6 @@ stdenv.mkDerivation (rec {
   configureFlags = "--with-preferences-dir=.${name} --program-suffix=-${version} --with-datadir-name=${name} --with-boost=${boost}/include --disable-python";
 
   meta = {
-    description = "
-      The Battle for Wesnoth  is a free, turn-based strategy game with a fantasy theme.
-";
+    description = "The Battle for Wesnoth, a free, turn-based strategy game with a fantasy theme";
   };
-})
+}
diff --git a/pkgs/games/zdoom/default.nix b/pkgs/games/zdoom/default.nix
new file mode 100644
index 000000000000..4bf8c526f586
--- /dev/null
+++ b/pkgs/games/zdoom/default.nix
@@ -0,0 +1,29 @@
+{stdenv, fetchsvn, cmake, SDL, nasm, p7zip, zlib, flac, fmod, libjpeg}:
+
+stdenv.mkDerivation {
+  name = "zdoom-svn-1424";
+  src = fetchsvn {
+    url = http://mancubus.net/svn/hosted/zdoom/zdoom/trunk;
+    rev = 1424;
+  };
+  buildInputs = [cmake nasm SDL p7zip zlib flac fmod libjpeg];
+
+  cmakeFlags = [ "-DSDL_INCLUDE_DIR=${SDL}/include/SDL" ];
+   
+  preConfigure=''
+    sed s@zdoom.pk3@$out/share/zdoom.pk3@ -i src/version.h
+ '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp zdoom $out/bin
+    mkdir -p $out/share
+    cp zdoom.pk3 $out/share
+  '';
+
+  meta = {
+    homepage = http://zdoom.org/;
+    description = "Enhanced port of the official DOOM source code";
+  };
+}
+
diff --git a/pkgs/lib/attrsets.nix b/pkgs/lib/attrsets.nix
index 201fb91bd000..dba58f007890 100644
--- a/pkgs/lib/attrsets.nix
+++ b/pkgs/lib/attrsets.nix
@@ -1,15 +1,20 @@
 # Operations on attribute sets.
 
-with { inherit (builtins) head tail; };
+with {
+  inherit (builtins) head tail;
+  inherit (import ./default.nix) fold;
+  inherit (import ./strings.nix) concatStringsSep;
+};
 
 rec {
   inherit (builtins) attrNames listToAttrs hasAttr isAttrs;
 
 
-  # Return an attribute from nested attribute sets.  For instance ["x"
-  # "y"] applied to some set e returns e.x.y, if it exists.  The
-  # default value is returned otherwise.  !!! there is also
-  # builtins.getAttr (is there a better name for this function?)
+  /* Return an attribute from nested attribute sets.  For instance
+     ["x" "y"] applied to some set e returns e.x.y, if it exists.  The
+     default value is returned otherwise.  !!! there is also
+     builtins.getAttr (is there a better name for this function?)
+  */
   getAttr = attrPath: default: e:
     let attr = head attrPath;
     in
@@ -19,4 +24,79 @@ rec {
       else default;
 
 
-}
\ No newline at end of file
+  getAttrFromPath = attrPath: set:
+    let errorMsg = "cannot find attribute `" + concatStringsSep "." attrPath + "'";
+    in getAttr attrPath (abort errorMsg) set;
+      
+
+  /* Return the specified attributes from a set.
+
+     Example:
+       attrVals ["a" "b" "c"] as
+       => [as.a as.b as.c]
+  */
+  attrVals = nameList: set:
+    map (x: builtins.getAttr x set) nameList;
+
+
+  /* Return the values of all attributes in the given set, sorted by
+     attribute name.
+
+     Example:
+       attrValues {c = 3; a = 1; b = 2;}
+       => [1 2 3]
+  */
+  attrValues = attrs: attrVals (attrNames attrs) attrs;
+
+
+  /* Collect each attribute named `attr' from a list of attribute
+     sets.  Sets that don't contain the named attribute are ignored.
+
+     Example:
+       catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}]
+       => [1 2]
+  */
+  catAttrs = attr: l: fold (s: l: if hasAttr attr s then [(builtins.getAttr attr s)] ++ l else l) [] l;
+
+
+  /* Utility function that creates a {name, value} pair as expected by
+     builtins.listToAttrs. */
+  nameValuePair = name: value: { inherit name value; };
+
+  
+  /* Apply a function to each element in an attribute set.  The
+     function takes two arguments --- the attribute name and its value
+     --- and returns the new value for the attribute.  The result is a
+     new attribute set.
+
+     Example:
+       mapAttrs (name: value: name + "-" + value)
+          {x = "foo"; y = "bar";}
+       => {x = "x-foo"; y = "y-bar";}
+  */
+  mapAttrs = f: set:
+    listToAttrs (map (attr: nameValuePair attr (f attr (builtins.getAttr attr set))) (attrNames set));
+    
+
+  /* Like `mapAttrs', except that it recursively applies itself to
+     values that attribute sets.  Also, the first argument is a *list*
+     of the names of the containing attributes.
+
+     Example:
+       mapAttrsRecursive (path: value: concatStringsSep "-" (path ++ [value]))
+         { n = { a = "A"; m = { b = "B"; c = "C"; }; }; d = "D"; }
+       => { n = { a = "n-a-A"; m = { b = "n-m-b-B"; c = "n-m-c-C"; }; }; d = "d-D"; }
+  */
+  mapAttrsRecursive =
+    let
+      recurse = path: f: set:
+        let
+          g =
+            name: value:
+            if isAttrs value
+              then recurse (path ++ [name]) f value
+              else f (path ++ [name]) value;
+        in mapAttrs g set;
+    in recurse [];
+  
+}
diff --git a/pkgs/lib/composable-derivation.nix b/pkgs/lib/composable-derivation.nix
index f597dc07bd6a..03f1f48ec72c 100644
--- a/pkgs/lib/composable-derivation.nix
+++ b/pkgs/lib/composable-derivation.nix
@@ -9,18 +9,21 @@ let inherit (lib) nv nvs; in
   # 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
+  # TODO add newer example using new syntax (kernel derivation proposal -> mailinglist)
   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);
+        mkDerivation ? pkgs.stdenv.mkDerivation,
+
+        # list of functions to be applied before defaultOverridableDelayableArgs removes removeAttrs names
+        # prepareDerivationArgs handles derivation configurations
+        applyPreTidy ? [ lib.prepareDerivationArgs ],
+
+        # consider adding addtional elements by derivation.merge { removeAttrs = ["elem"]; };
+        removeAttrs ? ["cfg" "flags"]
+
+      }: (lib.defaultOverridableDelayableArgs ( a: mkDerivation a) 
+         {
+           inherit applyPreTidy removeAttrs;
+         }).merge;
 
   # some utility functions
   # use this function to generate flag attrs for prepareDerivationArgs
diff --git a/pkgs/lib/debug.nix b/pkgs/lib/debug.nix
index 23d1a85c72fd..55d6a0d1b65f 100644
--- a/pkgs/lib/debug.nix
+++ b/pkgs/lib/debug.nix
@@ -1,3 +1,5 @@
+let lib = import ./default.nix; in
+
 rec {
 
 
@@ -10,6 +12,29 @@ rec {
     then builtins.addErrorContext
     else msg: val: val;
 
+  addErrorContextToAttrs = lib.mapAttrs (a : v : lib.addErrorContext "while evaluating ${a}" v);
+
+  debugVal = if builtins ? trace then x: (builtins.trace x x) else x: x;
+  debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x;
 
+  # this can help debug your code as well - designed to not produce thousands of lines
+  traceWhatis = x : __trace (whatis x) x;
+  traceMarked = str: x: __trace (str + (whatis x)) x;
+  attrNamesToStr = a : lib.concatStringsSep "; " (map (x : "${x}=") (__attrNames a));
+  whatis = x :
+      if (__isAttrs x) then
+          if (x ? outPath) then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
+          else "x is attr set { ${attrNamesToStr x} }"
+      else if (__isFunction x) then "x is a function"
+      else if (x == []) then "x is an empty list"
+      else if (__isList x) then "x is a list, first item is : ${whatis (__head x)}"
+      else if (x == true) then "x is boolean true"
+      else if (x == false) then "x is boolean false"
+      else if (x == null) then "x is null"
+      else "x is probably a string starting, starting characters: ${__substring 0 50 x}..";
+  # trace the arguments passed to function and its result 
+  traceCall  = n : f : a : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
+  traceCall2 = n : f : a : b : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
+  traceCall3 = n : f : a : b : c : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c));
 
-}
\ No newline at end of file
+}
diff --git a/pkgs/lib/misc-tests.nix b/pkgs/lib/misc-tests.nix
new file mode 100644
index 000000000000..f8deb1b1a8ab
--- /dev/null
+++ b/pkgs/lib/misc-tests.nix
@@ -0,0 +1,53 @@
+let lib = import ./default.nix;
+
+    eqStrictTest =
+      let inherit(lib) eqStrict; in
+      assert eqStrict 2 2;
+      assert !(eqStrict 3 2);
+      assert eqStrict [2 1] [2 1];
+      assert !(eqStrict [1 3] [1 2]);
+      assert eqStrict {a = 7; b = 20;} {b= 20; a = 7;};
+      assert eqStrict [{a = 7; b = 20;}] [{b= 20; a = 7;}];
+      assert eqStrict {a = [7 8]; b = 20;} {b= 20; a = [7 8];};
+      "ok";
+
+    overridableDelayableArgsTest =
+      let inherit (lib) defaultOverridableDelayableArgs;
+          res1 = defaultOverridableDelayableArgs lib.id {};
+          res2 = defaultOverridableDelayableArgs lib.id { a = 7; };
+          res3 = let x = defaultOverridableDelayableArgs lib.id { a = 7; };
+                 in (x.merge) { b = 10; };
+          res4 = let x = defaultOverridableDelayableArgs lib.id { a = 7; };
+                in (x.merge) ( x: { b = 10; });
+          res5 = let x = defaultOverridableDelayableArgs lib.id { a = 7; };
+                in (x.merge) ( x: { a = __add x.a 3; });
+          res6 = let x = defaultOverridableDelayableArgs lib.id { a = 7; mergeAttrBy = { a = __add; }; };
+                     y = x.merge {};
+                in (y.merge) { a = 10; };
+
+          resRem7 = res6.replace (a : removeAttrs a ["a"]);
+
+          resReplace6 = let x = defaultOverridableDelayableArgs lib.id { a = 7; mergeAttrBy = { a = __add; }; };
+                            x2 = x.merge { a = 20; }; # now we have 27
+                        in (x2.replace) { a = 10; }; # and override the value by 10
+
+          # fixed tests (delayed args): (when using them add some comments, please)
+          resFixed1 = 
+                let x = defaultOverridableDelayableArgs lib.id ( x : { a = 7; c = x.fixed.b; });
+                    y = x.merge (x : { name = "name-${builtins.toString x.fixed.c}"; });
+                in (y.merge) { b = 10; };
+          strip = attrs : removeAttrs attrs ["merge" "replace"];
+
+          in 
+             assert lib.eqStrict (strip res1) { };
+             assert lib.eqStrict (strip res2) { a = 7; };
+             assert lib.eqStrict (strip res3) { a = 7; b = 10; };
+             assert lib.eqStrict (strip res4) { a = 7; b = 10; };
+             assert lib.eqStrict (strip res5) { a = 10; };
+             assert lib.eqStrict (strip res6) { a = 17; };
+             assert lib.eqStrict (strip resRem7) {};
+             assert lib.eqStrict (strip resFixed1) { a = 7; b = 10; c =10; name = "name-10"; };
+             "ok";
+
+
+in [ eqStrictTest overridableDelayableArgsTest ]
diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix
index 548b8d22edf1..21dd6d6c034c 100644
--- a/pkgs/lib/misc.nix
+++ b/pkgs/lib/misc.nix
@@ -35,22 +35,56 @@ rec {
       # now add the function with composed args already applied to the final attrs
     setAttrMerge "passthru" {} (f arg) ( x : x // { function = foldArgs merger f arg; } );
 
-  # returns f x // { passthru.fun = y : f (merge x y); } while preserving other passthru names.
-  # example: let ex = applyAndFun (x : removeAttrs x ["fixed"])  (mergeOrApply mergeAttr) {name = 6;};
-  #              usage1 = ex.passthru.fun { name = 7; };    # result: { name = 7;}
-  #              usage2 = ex.passthru.fun (a: a // {name = __add a.name 1; }); # result: { a = 7; }
-  # fix usage:
-  #              usage3a = ex.passthru.fun (a: a // {name2 = a.fixed.toBePassed; }); # usage3a will fail because toBePassed is not yet given
-  #              usage3b usage3a.passthru.fun { toBePassed = "foo";}; # result { name = 7; name2 = "foo"; toBePassed = "foo"; fixed = <this attrs>; }
-  applyAndFun = f : merge : x : assert (__isAttrs x || __isFunction x);
-    let takeFix = if (__isFunction x) then x else (attr: merge attr x); in
-    setAttrMerge "passthru" {} (lib.fix (fixed : f (takeFix {inherit fixed;})))
-      ( y : y //
-        {
-          fun = z : applyAndFun f merge (fixed: merge (takeFix fixed) z);
-          funMerge = z : applyAndFun f merge (fixed: let e = takeFix fixed; in merge e (merge e z));
-        } );
-  mergeOrApply = merge : x : y : if (__isFunction y) then  y x else merge x y;
+  # predecessors: proposed replacement for applyAndFun (which has a bug cause it merges twice)
+  # the naming "overridableDelayableArgs" tries to express that you can
+  # - override attr values which have been supplied earlier
+  # - use attr values before they have been supplied by accessing the fix point
+  #   name "fixed"
+  # f: the (delayed overridden) arguments are applied to this
+  #
+  # initial: initial attrs arguments and settings. see defaultOverridableDelayableArgs
+  #
+  # returns: f applied to the arguments // special attributes attrs
+  #     a) merge: merge applied args with new args. Wether an argument is overridden depends on the merge settings
+  #     b) replace: this let's you replace and remove names no matter which merge function has been set
+  #
+  # examples: see test cases "res" below;
+  overridableDelayableArgs =
+          f :        # the function applied to the arguments
+          initial :  # you pass attrs, the functions below are passing a function taking the fix argument
+    let
+        takeFixed = if (__isFunction initial) then initial else (fixed : initial); # transform initial to an expression always taking the fixed argument
+        tidy = args : 
+            let # apply all functions given in "applyPreTidy" in sequence
+                applyPreTidyFun = fold ( n : a : x : n ( a x ) ) lib.id (maybeAttr "applyPreTidy" [] args);
+            in removeAttrs (applyPreTidyFun args) ( ["applyPreTidy"] ++ (maybeAttr  "removeAttrs" [] args) ); # tidy up args before applying them
+        fun = n : x :
+             let newArgs = fixed :
+                     let args = takeFixed fixed; 
+                         mergeFun = __getAttr n args;
+                     in if __isAttrs x then (mergeFun args x)
+                        else assert __isFunction x;
+                             mergeFun args (x ( args // { inherit fixed; }));
+             in overridableDelayableArgs f newArgs;
+    in
+    (f (tidy (lib.fix takeFixed))) // {
+      merge   = fun "mergeFun";
+      replace = fun "keepFun";
+    };
+  defaultOverridableDelayableArgs = f : 
+      let defaults = {
+            mergeFun = mergeAttrByFunc; # default merge function. merge strategie (concatenate lists, strings) is given by mergeAttrBy
+            keepFun = a : b : { inherit (a) removeAttrs mergeFun keepFun mergeAttrBy; } // b; # even when using replace preserve these values
+            applyPreTidy = []; # list of functions applied to args before args are tidied up (usage case : prepareDerivationArgs)
+            mergeAttrBy = mergeAttrBy // {
+              applyPreTidy = a : b : a ++ b;
+              removeAttrs = a : b: a ++ b;
+            };
+            removeAttrs = ["mergeFun" "keepFun" "mergeAttrBy" "removeAttrs" "fixed" ]; # before applying the arguments to the function make sure these names are gone
+          };
+      in (overridableDelayableArgs f defaults).merge;
+
+
 
   # rec { # an example of how composedArgsAndFun can be used
   #  a  = composedArgsAndFun (x : x) { a = ["2"]; meta = { d = "bar";}; };
@@ -189,30 +223,6 @@ rec {
 	innerModifySumArgs f x (a // b);
   modifySumArgs = f: x: innerModifySumArgs f x {};
 
-  debugVal = if builtins ? trace then x: (builtins.trace x x) else x: x;
-  debugXMLVal = if builtins ? trace then x: (builtins.trace (builtins.toXML x) x) else x: x;
-
-  # this can help debug your code as well - designed to not produce thousands of lines
-  traceWhatis = x : __trace (whatis x) x;
-  traceMarked = str: x: __trace (str + (whatis x)) x;
-  attrNamesToStr = a : concatStringsSep "; " (map (x : "${x}=") (__attrNames a));
-  whatis = x :
-      if (__isAttrs x) then
-          if (x ? outPath) then "x is a derivation, name ${if x ? name then x.name else "<no name>"}, { ${attrNamesToStr x} }"
-          else "x is attr set { ${attrNamesToStr x} }"
-      else if (__isFunction x) then "x is a function"
-      else if (x == []) then "x is an empty list"
-      else if (__isList x) then "x is a list, first item is : ${whatis (__head x)}"
-      else if (x == true) then "x is boolean true"
-      else if (x == false) then "x is boolean false"
-      else if (x == null) then "x is null"
-      else "x is probably a string starting, starting characters: ${__substring 0 50 x}..";
-  # trace the arguments passed to function and its result 
-  traceCall  = n : f : a : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a));
-  traceCall2 = n : f : a : b : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b));
-  traceCall3 = n : f : a : b : c : let t = n2 : x : traceMarked "${n} ${n2}:" x; in t "result" (f (t "arg 1" a) (t "arg 2" b) (t "arg 3" c));
-
-
 
   innerClosePropagation = ready: list: if list == [] then ready else
     if (head list) ? propagatedBuildInputs then 
@@ -226,14 +236,8 @@ rec {
   # should be renamed to mapAttrsFlatten
   mapRecordFlatten = f : r : map (attr: f attr (builtins.getAttr attr r) ) (attrNames r);
 
-  # maps a function on each attr value
-  # f = attr : value : ..
-  mapAttrs = f : r : listToAttrs ( mapRecordFlatten (a : v : nv a ( f a v ) )  r);
-
-  # to be used with listToAttrs (_a_ttribute _v_alue)
-  nv = name : value : { inherit name value; };
   # attribute set containing one attribute
-  nvs = name : value : listToAttrs [ (nv name value) ];
+  nvs = name : value : listToAttrs [ (nameValuePair name value) ];
   # adds / replaces an attribute of an attribute set
   setAttr = set : name : v : set // (nvs name v);
 
@@ -243,12 +247,6 @@ rec {
   setAttrMerge = name : default : attrs : f :
     setAttr attrs name (f (maybeAttr name default attrs));
 
-  # iterates over a list of attributes collecting the attribute attr if it exists
-  catAttrs = attr : l : fold ( s : l : if (hasAttr attr s) then [(builtins.getAttr attr s)] ++ l else l) [] l;
-
-  attrVals = nameList : attrSet :
-    map (x: builtins.getAttr x attrSet) nameList;
-
   # Using f = a : b = b the result is similar to //
   # merge attributes with custom function handling the case that the attribute
   # exists in both sets
@@ -293,7 +291,7 @@ rec {
   # };
   # will result in
   # { mergeAttrsBy = [...]; buildInputs = [ a b c d ]; }
-  # is used by prepareDerivationArgs and can be used when composing using
+  # is used by prepareDerivationArgs, defaultOverridableDelayableArgs and can be used when composing using
   # foldArgs, composedArgsAndFun or applyAndFun. Example: composableDerivation in all-packages.nix
   mergeAttrByFunc = x : y :
     let
@@ -318,8 +316,8 @@ rec {
   mergeAttrsByFuncDefaults = foldl mergeAttrByFunc { inherit mergeAttrBy; };
   # sane defaults (same name as attr name so that inherit can be used)
   mergeAttrBy = # { buildInputs = concatList; [...]; passthru = mergeAttr; [..]; }
-    listToAttrs (map (n : nv n lib.concat) [ "buildInputs" "propagatedBuildInputs" "configureFlags" "prePhases" "postAll" ])
-    // listToAttrs (map (n : nv n lib.mergeAttrs) [ "passthru" "meta" "cfg" "flags" ]);
+    listToAttrs (map (n : nameValuePair n lib.concat) [ "buildInputs" "propagatedBuildInputs" "configureFlags" "prePhases" "postAll" ])
+    // listToAttrs (map (n : nameValuePair n lib.mergeAttrs) [ "passthru" "meta" "cfg" "flags" ]);
 
   # returns atribute values as a list 
   flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set);
@@ -328,7 +326,7 @@ rec {
   # pick attrs subset_attr_names and apply f 
   subsetmap = f : attrs : subset_attr_names : 
     listToAttrs (fold ( attr : r : if __hasAttr attr attrs
-          then r ++ [ (  nv attr ( f (__getAttr attr attrs) ) ) ] else r ) []
+          then r ++ [ ( nameValuePair attr ( f (__getAttr attr attrs) ) ) ] else r ) []
       subset_attr_names );
 
   # prepareDerivationArgs tries to make writing configurable derivations easier
@@ -364,10 +362,11 @@ rec {
   # heavily in the new python and libs implementation
   #
   # should we check for misspelled cfg options?
+  # TODO use args.mergeFun here as well?
   prepareDerivationArgs = args:
     let args2 = { cfg = {}; flags = {}; } // args;
         flagName = name : "${name}Support";
-        cfgWithDefaults = (listToAttrs (map (n : nv (flagName n) false) (attrNames args2.flags)))
+        cfgWithDefaults = (listToAttrs (map (n : nameValuePair (flagName n) false) (attrNames args2.flags)))
                           // args2.cfg;
         opts = flattenAttrs (mapAttrs (a : v :
                 let v2 = if (v ? set || v ? unset) then v else { set = v; };
@@ -379,7 +378,19 @@ rec {
                ) args2.flags );
     in removeAttrs
       (mergeAttrsByFuncDefaults ([args] ++ opts ++ [{ passthru = cfgWithDefaults; }]))
-      ["flags" "cfg" "mergeAttrBy" "fixed" ]; # fixed may be passed as fix argument or such
-
-
-}
\ No newline at end of file
+      ["flags" "cfg" "mergeAttrBy" ];
+
+
+  # deep, strict equality testing. This should be implemented as primop
+  eqStrict = a : b :
+    let eqListStrict = a : b :
+      if (a == []) != (b == []) then false
+      else if a == [] then true
+      else eqStrict (__head a) (__head b) && eqListStrict (__tail a) (__tail b);
+    in
+    if __isList a && __isList b then eqListStrict a b
+    else if __isAttrs a && isAttrs b then
+      (eqListStrict (__attrNames a) (__attrNames b))
+      && (eqListStrict (lib.attrValues a) (lib.attrValues b))
+    else a == b; # FIXME !
+}
diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix
index 6d8bf4633de4..6a4d6b4b695e 100644
--- a/pkgs/lib/options.nix
+++ b/pkgs/lib/options.nix
@@ -3,7 +3,9 @@
 let lib = import ./default.nix; in
 
 with { inherit (builtins) head tail; };
+with import ./trivial.nix;
 with import ./lists.nix;
+with import ./misc.nix;
 with import ./attrsets.nix;
 
 rec {
@@ -11,7 +13,8 @@ rec {
 
   mkOption = attrs: attrs // {_type = "option";};
 
-  typeOf = x: if (__isAttrs x && x ? _type) then x._type else "";
+  hasType = x: __isAttrs x && x ? _type;
+  typeOf = x: if hasType x then x._type else "";
 
   isOption = attrs: (typeOf attrs) == "option";
 
@@ -97,11 +100,11 @@ rec {
           } // (head decls);
 
           # Return the list of option sets.
-          optAttrs = map delayIf defs;
+          optAttrs = map delayProperties defs;
 
           # return the list of option values.
           # Remove undefined values that are coming from evalIf.
-          optValues = filter (x: !isNotdef x) (map evalIf defs);
+          optValues = evalProperties defs;
         in
           if decls == [] then handleOptionSets optionHandler name optAttrs
           else lib.addErrorContext "while evaluating the option ${name}:" (
@@ -150,9 +153,9 @@ rec {
     let
       # remove possible mkIf to access the require attribute.
       noImportConditions = cfgSet0:
-        let cfgSet1 = delayIf cfgSet0; in
+        let cfgSet1 = delayProperties cfgSet0; in
         if cfgSet1 ? require then
-          cfgSet1 // { require = rmIf cfgSet1.require; }
+          cfgSet1 // { require = rmProperties cfgSet1.require; }
         else
           cfgSet1;
 
@@ -176,12 +179,39 @@ rec {
             cfg2 = noImportConditions cfg1;
         in cfg2;
 
-      getRequire = x: toList (getAttr ["require"] [] (preprocess x));
+      getRequire = x:
+        toList (getAttr ["require"] [] (preprocess x));
+      getCleanRequire = x: map rmProperties (getRequire x);
       rmRequire = x: removeAttrs (preprocess x) ["require"];
+
+      duplicateIncludeProperties = list:
+        # iterate on all configurations
+        fold (cfg: l:
+          # iterate on all imported configuration from cfg
+          fold (include: l:
+            # clean up the included cfg to get the same result
+            let includedCfg = rmProperties include; in
+            # if the include has properties
+            if include != includedCfg then
+              # iterate on all configurations
+              map (cfg:
+                # if the imported configuration is seen
+                if (rmProperties cfg) == includedCfg then
+                  # copy the properties from the import to the configuration.
+                  delayProperties (copyProperties include cfg)
+                else
+                  cfg
+              ) l
+            else
+              l
+          ) l (getRequire cfg)
+        ) list list;
     in
       merge "" (
         map rmRequire (
-          lib.uniqFlatten getRequire [] [] (toList opts)
+          duplicateIncludeProperties (
+            lib.uniqFlatten getCleanRequire [] [] (toList opts)
+          )
         )
       );
 
@@ -203,65 +233,351 @@ rec {
         (l + (if l=="" then "" else ".") + s) (builtins.getAttr s attrs)))
         (builtins.attrNames attrs)));
 
-        
+  /* Option Properties */
+  # Generalize the problem of delayable properties.  Any property can be created
+
+
+  # Tell that nothing is defined.  When properties are evaluated, this type
+  # is used to remove an entry.  Thus if your property evaluation semantic
+  # implies that you have to mute the content of an attribute, then your
+  # property should produce this value.
+  isNotdef = attrs: (typeOf attrs) == "notdef";
+  mkNotdef = {_type = "notdef";};
+
+  # General property type, it has a property attribute and a content
+  # attribute.  The property attribute refer to an attribute set which
+  # contains a _type attribute and a list of functions which are used to
+  # evaluate this property.  The content attribute is used to stack property
+  # on top of each other.
+  # 
+  # The optional functions which may be contained in the property attribute
+  # are:
+  #  - onDelay: run on a copied property.
+  #  - onGlobalDelay: run on all copied properties.
+  #  - onEval: run on an evaluated property.
+  #  - onGlobalEval: run on a list of property stack on top of their values.
+  isProperty = attrs: (typeOf attrs) == "property";
+  mkProperty = p@{property, content, ...}: p // {
+    _type = "property";
+  };
+
+  # Go throw the stack of properties and apply the function `op' on all
+  # property and call the function `nul' on the final value which is not a
+  # property.  The stack is traversed in reversed order.  The `op' function
+  # should expect a property with a content which have been modified.
+  # 
+  # Warning: The `op' function expects only one argument in order to avoid
+  # calls to mkProperties as the argument is already a valid property which
+  # contains the result of the folding inside the content attribute.
+  foldProperty = op: nul: attrs:
+    if isProperty attrs then
+      op (attrs // {
+        content = foldProperty op nul attrs.content;
+      })
+    else
+      nul attrs;
+
+  # Simple function which can be used as the `op' argument of the
+  # foldProperty function.  Properties that you don't want to handle can be
+  # ignored with the `id' function.  `isSearched' is a function which should
+  # check the type of a property and return a boolean value.  `thenFun' and
+  # `elseFun' are functions which behave as the `op' argument of the
+  # foldProperty function.
+  foldFilter = isSearched: thenFun: elseFun: attrs:
+    if isSearched attrs.property then
+      thenFun attrs
+    else
+      elseFun attrs;
+
+
+  # Move properties from the current attribute set to the attribute
+  # contained in this attribute set.  This trigger property handlers called
+  # `onDelay' and `onGlobalDelay'.
+  delayProperties = attrs:
+    let cleanAttrs = rmProperties attrs; in
+    if cleanAttrs != attrs then
+      lib.mapAttrs (a: v:
+        lib.addErrorContext "while moving properties on the attribute `${a}'." (
+          triggerPropertiesGlobalDelay a (
+            triggerPropertiesDelay a (
+              copyProperties attrs v
+      )))) cleanAttrs
+    else
+      attrs;
+
+  # Call onDelay functions.
+  triggerPropertiesDelay = name: attrs:
+    let
+      callOnDelay = p@{property, ...}:
+        lib.addErrorContext "while calling a onDelay function." (
+          if property ? onDelay then
+            property.onDelay name p
+          else
+            p
+        );
+    in
+      foldProperty callOnDelay id attrs;
+
+  # Call onGlobalDelay functions.
+  triggerPropertiesGlobalDelay = name: attrs:
+    let
+      globalDelayFuns = uniqListExt {
+        getter = property: property._type;
+        inputList = foldProperty (p@{property, content, ...}:
+          if property ? onGlobalDelay then
+            [ property ] ++ content
+          else
+            content
+        ) (a: []) attrs;
+      };
+
+      callOnGlobalDelay = property: content:
+        lib.addErrorContext "while calling a onGlobalDelay function." (
+          property.onGlobalDelay name content
+        );
+    in
+      fold callOnGlobalDelay attrs globalDelayFuns;
+
+  # Expect a list of values which may have properties and return the same
+  # list of values where all properties have been evaluated and where all
+  # ignored values are removed.  This trigger property handlers called
+  # `onEval' and `onGlobalEval'.
+  evalProperties = valList:
+    if valList != [] then
+      filter (x: !isNotdef x) (
+        lib.addErrorContext "while evaluating properties an attribute." (
+          triggerPropertiesGlobalEval (
+            map triggerPropertiesEval valList
+      )))
+    else
+      valList;
+
+  # Call onEval function
+  triggerPropertiesEval = val:
+    foldProperty (p@{property, ...}:
+      lib.addErrorContext "while calling a onEval function." (
+        if property ? onEval then
+          property.onEval p
+        else
+          p
+      )
+    ) id val;
+
+  # Call onGlobalEval function
+  triggerPropertiesGlobalEval = valList:
+    let
+      globalEvalFuns = uniqListExt {
+        getter = property: property._type;
+        inputList =
+          fold (attrs: list:
+            foldProperty (p@{property, content, ...}:
+              if property ? onGlobalEval then
+                [ property ] ++ content
+              else
+                content
+            ) (a: list) attrs
+          ) [] valList;
+      };
+
+      callOnGlobalEval = property: valList:
+        lib.addErrorContext "while calling a onGlobalEval function." (
+          property.onGlobalEval valList
+        );
+    in
+      fold callOnGlobalEval valList globalEvalFuns;
+
+  # Remove all properties on top of a value and return the value.
+  rmProperties =
+    foldProperty (p@{content, ...}: content) id;
+
+  # Copy properties defined on a value on another value.
+  copyProperties = attrs: newAttrs:
+    foldProperty id (x: newAttrs) attrs;
+
   /* If. ThenElse. Always. */
-  # !!! cleanup needed
 
   # create "if" statement that can be dealyed on sets until a "then-else" or
   # "always" set is reached.  When an always set is reached the condition
   # is ignore.
 
+  # Create a "If" property which only contains a condition.
   isIf = attrs: (typeOf attrs) == "if";
-  mkIf = condition: thenelse:
-    if isIf thenelse then
-      mkIf (condition && thenelse.condition) thenelse.thenelse
-    else {
+  mkIf = condition: content: mkProperty {
+    property = {
       _type = "if";
-      inherit condition thenelse;
+      onGlobalDelay = onIfGlobalDelay;
+      onEval = onIfEval;
+      inherit condition;
     };
+    inherit content;
+  };
 
-
-  isNotdef = attrs: (typeOf attrs) == "notdef";
-  mkNotdef = {_type = "notdef";};
-
-
+  # Create a "ThenElse" property which contains choices which can choosed by
+  # the evaluation of an "If" statement.
   isThenElse = attrs: (typeOf attrs) == "then-else";
   mkThenElse = attrs:
     assert attrs ? thenPart && attrs ? elsePart;
-    attrs // { _type = "then-else"; };
-
+    mkProperty {
+      property = {
+        _type = "then-else";
+        onEval = val: throw "Missing mkIf statement.";
+        inherit (attrs) thenPart elsePart;
+      };
+      content = mkNotdef;
+    };
 
+  # Create an "Always" property remove ignore all "If" statement.
   isAlways = attrs: (typeOf attrs) == "always";
-  mkAlways = value: { inherit value; _type = "always"; };
-
-  pushIf = f: attrs:
-    if isIf attrs then pushIf f (
-      let val = attrs.thenelse; in
-      # evaluate the condition.
-      if isThenElse val then
-        if attrs.condition then
-          val.thenPart
+  mkAlways = value:
+    mkProperty {
+      property = {
+        _type = "always";
+        onEval = p@{content, ...}: content;
+        inherit value;
+      };
+      content = mkNotdef;
+    };
+
+  # Remove all "If" statement defined on a value.
+  rmIf = foldProperty (
+      foldFilter isIf
+        ({content, ...}: content)
+        id
+    ) id;
+
+  # Evaluate the "If" statements when either "ThenElse" or "Always"
+  # statement is encounter.  Otherwise it remove multiple If statement and
+  # replace them by one "If" staement where the condition is the list of all
+  # conditions joined with a "and" operation.
+  onIfGlobalDelay = name: content:
+    let
+      # extract if statements and non-if statements and repectively put them
+      # in the attribute list and attrs.
+      ifProps =
+        foldProperty
+          (foldFilter (p: isIf p || isThenElse p || isAlways p)
+            # then, push the codition inside the list list
+            (p@{property, content, ...}:
+              { inherit (content) attrs;
+                list = [property] ++ content.list;
+              }
+            )
+            # otherwise, add the propertie.
+            (p@{property, content, ...}:
+              { inherit (content) list;
+                attrs = p // { content = content.attrs; };
+              }
+            )
+          )
+          (attrs: { list = []; inherit attrs; })
+          content;
+
+      # compute the list of if statements.
+      evalIf = content: condition: list:
+        if list == [] then
+          mkIf condition content
         else
-          val.elsePart
-      # ignore the condition.
-      else if isAlways val then
-        val.value
-      # otherwise
+          let p = head list; in
+
+          # evaluate the condition.
+          if isThenElse p then
+            if condition then
+              copyProperties content p.thenPart
+            else
+              copyProperties content p.elsePart
+          # ignore the condition.
+          else if isAlways p then
+            copyProperties content p.value
+          # otherwise (isIf)
+          else
+            evalIf content (condition && p.condition) (tail list);
+    in
+      evalIf ifProps.attrs true ifProps.list;
+
+  # Evaluate the condition of the "If" statement to either get the value or
+  # to ignore the value.
+  onIfEval = p@{property, content, ...}:
+    if property.condition then
+      content
+    else
+      mkNotdef;
+
+  /* mkOverride */
+
+  # Create an "Override" statement which allow the user to define
+  # prioprities between values.  The default priority is 100 and the lowest
+  # priorities are kept.  The template argument must reproduce the same
+  # attribute set hierachy to override leaves of the hierarchy.
+  isOverride = attrs: (typeOf attrs) == "override";
+  mkOverride = priority: template: content: mkProperty {
+    property = {
+      _type = "override";
+      onDelay = onOverrideDelay;
+      onGlobalEval = onOverrideGlobalEval;
+      inherit priority template;
+    };
+    inherit content;
+  };
+
+  # Make the template traversal in function of the property traversal.  If
+  # the template define a non-empty attribute set, then the property is
+  # copied only on all mentionned attributes inside the template.
+  # Otherwise, the property is kept on all sub-attribute definitions.
+  onOverrideDelay = name: p@{property, content, ...}:
+    let inherit (property) template; in
+    if builtins.isAttrs template && template != {} then
+      if builtins.hasAttr name template then
+        p // {
+          property = p.property // {
+            template = builtins.getAttr name template;
+          };
+        }
+      # Do not override the attribute \name\
       else
-        f attrs.condition val)
+        content
+    # Override values defined inside the attribute \name\.
     else
-      attrs;
+      p;
 
-  # take care otherwise you will have to handle this by hand.
-  rmIf = pushIf (condition: val: val);
-
-  evalIf = pushIf (condition: val:
-    if condition then val else mkNotdef
-  );
-
-  delayIf = pushIf (condition: val:
-    # rewrite the condition on sub-attributes.
-    lib.mapAttrs (name: mkIf condition) val
-  );
+  # Ignore all values which have a higher value of the priority number.
+  onOverrideGlobalEval = valList:
+    let
+      defaultPrio = 100;
+
+      inherit (builtins) lessThan;
+
+      getPrioVal =
+        foldProperty
+          (foldFilter isOverride
+            (p@{property, content, ...}:
+              if lessThan content.priority property.priority then
+                content
+              else
+                content // {
+                  inherit (property) priority;
+                }
+            )
+            (p@{property, content, ...}:
+              content // {
+                value = p // { content = content.value; };
+              }
+            )
+          ) (value: { priority = defaultPrio; inherit value; });
+
+      prioValList = map getPrioVal valList;
+
+      higherPrio = fold (x: y:
+        if lessThan x.priority y then
+          x.priority
+        else
+          y
+      ) defaultPrio prioValList;
+    in
+      map (x:
+        if x.priority == higherPrio then
+          x.value
+        else
+          mkNotdef
+      ) prioValList;
 
 }
\ No newline at end of file
diff --git a/pkgs/lib/strings.nix b/pkgs/lib/strings.nix
index 8986d9c42d98..0e90b6f64771 100644
--- a/pkgs/lib/strings.nix
+++ b/pkgs/lib/strings.nix
@@ -81,5 +81,7 @@ rec {
           else takeTillSlash (__sub left 1) (__add c 1) s; in
       takeTillSlash (__sub (__stringLength s) 1) 1 s;
 
-  
-}
\ No newline at end of file
+  # Compares strings not requiring context equality
+  # Obviously, a workaround but works on all Nix versions
+  eqStrings = a: b: (a+(substring 0 0 b)) == ((substring 0 0 a)+b);
+}
diff --git a/pkgs/lib/tests.nix b/pkgs/lib/tests.nix
new file mode 100644
index 000000000000..2e75d7f141fa
--- /dev/null
+++ b/pkgs/lib/tests.nix
@@ -0,0 +1,8 @@
+let lib = import ./default.nix;
+
+  miscTests = import ./misc-tests.nix;
+
+in
+  if lib.all (a : a == "ok") (lib.concatLists [ miscTests ]) then
+    throw "all tests have passed"
+    else "there has been a some lib test failures"
diff --git a/pkgs/misc/emulators/dosbox/default.nix b/pkgs/misc/emulators/dosbox/default.nix
index 7ce5ac75c106..84f59075d73b 100644
--- a/pkgs/misc/emulators/dosbox/default.nix
+++ b/pkgs/misc/emulators/dosbox/default.nix
@@ -1,10 +1,17 @@
 {stdenv, fetchurl, SDL}:
 
-stdenv.mkDerivation { 
-  name = "dosbox-0.65";
+stdenv.mkDerivation rec { 
+  name = "dosbox-0.72";
+  
   src = fetchurl {
-    url = mirror://sourceforge/dosbox/dosbox-0.65.tar.gz;
-    md5 = "fef84c292c3aeae747368b9875c1575a";
+    url = "mirror://sourceforge/dosbox/${name}.tar.gz";
+    sha256 = "0ydck7jgvdwnpxakg2y83dmk2dnwx146cgidbmdn7h75y7cxfiqp";
   };
+  
   buildInputs = [SDL];
+
+  meta = {
+    homepage = http://www.dosbox.com/;
+    description = "A DOS emulator";
+  };
 }
diff --git a/pkgs/misc/emulators/wine/default.nix b/pkgs/misc/emulators/wine/default.nix
index 0c6b48c929ab..984e99bc92a3 100644
--- a/pkgs/misc/emulators/wine/default.nix
+++ b/pkgs/misc/emulators/wine/default.nix
@@ -7,12 +7,12 @@ assert stdenv.isLinux;
 
 let lib = import ../../../lib/default.nix; in
 
-stdenv.mkDerivation {
-  name = "wine-1.1.10";
+stdenv.mkDerivation rec {
+  name = "wine-1.1.15";
 
   src = fetchurl {
-    url = mirror://sourceforge/wine/wine-1.1.10.tar.bz2;
-    sha256 = "0saj7c2cmx720pdha04niz5c1jkym8zf5snjvdgxmwlizfjy2qr2";
+    url = "mirror://sourceforge/wine/${name}.tar.bz2";
+    sha256 = "0ki5isgzp62g2ikczf875z31iwqhzwf3n48j2r0s9hhrzkxgd5pg";
   };
 
   buildInputs = [
diff --git a/pkgs/misc/ghc68extraLibs/default.nix b/pkgs/misc/ghc68extraLibs/default.nix
index b3191cd1fa9a..57226d8e996e 100644
--- a/pkgs/misc/ghc68extraLibs/default.nix
+++ b/pkgs/misc/ghc68extraLibs/default.nix
@@ -448,5 +448,5 @@ rec {
             pass = if attrs ? pass then attrs.pass else {};
         });
       derivations = with lib; builtins.listToAttrs (lib.concatLists ( lib.mapRecordFlatten
-                ( n : attrs : let d = (toDerivation attrs); in [ (nv n d) (nv attrs.name d) ] ) pkgs ) );
+                ( n : attrs : let d = (toDerivation attrs); in [ (nameValuePair n d) (nameValuePair attrs.name d) ] ) pkgs ) );
     }.derivations
diff --git a/pkgs/misc/gxemul/default.nix b/pkgs/misc/gxemul/default.nix
index 548aad3bc27a..54418c1bc1ee 100644
--- a/pkgs/misc/gxemul/default.nix
+++ b/pkgs/misc/gxemul/default.nix
@@ -1,37 +1,35 @@
 args: with args;
 let edf = composableDerivation.edf;
     name = "gxemul-0.4.6"; in
-composableDerivation.composableDerivation {
+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/;";};
-    };
-
-    cfg = {
-      docSupport = true;
-      demosSupport = true;
-      manSupport = true;
-    };
+  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/;";};
+  };
 
-    installPhase = "ensureDir \$out/bin; cp gxemul \$out/bin;";
+  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";
+  };
 
-    meta = {
-      license = "BSD";
-      description = "A Machine Emulator, Mainly emulates MIPS, but supports other CPU type";
-      homepage = http://gavare.se/gxemul/;
-    };
+  configurePhase="./configure";
 
-    mergeAttrBy = { installPhase = a : b : "${a}\n${b}"; };
+  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 c7c010963c54..d8ef2863b1f1 100644
--- a/pkgs/misc/jackaudio/default.nix
+++ b/pkgs/misc/jackaudio/default.nix
@@ -2,52 +2,50 @@
 # still much to test but it compiles now
 args:
 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]; }; };
+composableDerivation {} {
+  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)
+    # 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
+    # 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";
-    };
-    };
+    # 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";
+  };
 }
diff --git a/pkgs/os-specific/linux/acpi/default.nix b/pkgs/os-specific/linux/acpi/default.nix
index 9c0935119071..d26a0aa7fcaa 100644
--- a/pkgs/os-specific/linux/acpi/default.nix
+++ b/pkgs/os-specific/linux/acpi/default.nix
@@ -9,10 +9,12 @@ stdenv.mkDerivation rec {
 
 
   meta = {
-    description = ''Linux ACPI client is a small command-line
-                    program that attempts to replicate the functionality of
-		    the "old" `apm' command on ACPI systems.  It includes
-		    battery and thermal information.'';
+    longDescription = ''
+      Linux ACPI client is a small command-line
+      program that attempts to replicate the functionality of
+      the "old" `apm' command on ACPI systems.  It includes
+      battery and thermal information.
+    '';
     homepage = http://grahame.angrygoats.net/acpi.shtml;
     license = "GPLv2+";
   };
diff --git a/pkgs/os-specific/linux/acpitool/default.nix b/pkgs/os-specific/linux/acpitool/default.nix
index e1f8d7105003..f400229ecc7d 100644
--- a/pkgs/os-specific/linux/acpitool/default.nix
+++ b/pkgs/os-specific/linux/acpitool/default.nix
@@ -1,16 +1,15 @@
-args: with args;
+{stdenv, fetchurl}:
 
 stdenv.mkDerivation rec {
   name = "acpitool-0.4.7";
+  
   src = fetchurl {
     url = "mirror://sourceforge/acpitool/${name}.tar.bz2";
     sha256 = "133bdgcq9ql0l940kp9m2v6wzdvkyv8f1dizwjbx7v96n8g2c239";
   };
 
-
   meta = {
-    description = ''ACPI Tool is a small, convenient command-line
-                    ACPI client with a lot of features for Linux.'';
+    description = "A small, convenient command-line ACPI client with a lot of features";
     homepage = http://freeunix.dyndns.org:8000/site2/acpitool.shtml;
     license = "GPLv2+";
   };
diff --git a/pkgs/os-specific/linux/atheros/0.9.3.3.nix b/pkgs/os-specific/linux/atheros/0.9.3.3.nix
index e28b6e274166..f34ad16c9ce1 100644
--- a/pkgs/os-specific/linux/atheros/0.9.3.3.nix
+++ b/pkgs/os-specific/linux/atheros/0.9.3.3.nix
@@ -32,9 +32,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs [doPatch doMakeInstall 
 			postInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/atheros/0.9.4.nix b/pkgs/os-specific/linux/atheros/0.9.4.nix
index 86a2a0eaf4f3..b50041109927 100644
--- a/pkgs/os-specific/linux/atheros/0.9.4.nix
+++ b/pkgs/os-specific/linux/atheros/0.9.4.nix
@@ -22,9 +22,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs [doMakeInstall 
 			postInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/atheros/r2756.nix b/pkgs/os-specific/linux/atheros/r2756.nix
index 7cbe5bcf314f..e26533738e34 100644
--- a/pkgs/os-specific/linux/atheros/r2756.nix
+++ b/pkgs/os-specific/linux/atheros/r2756.nix
@@ -33,9 +33,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs [doPatch doMakeInstall 
 			postInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver.";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/atheros/r3122.nix b/pkgs/os-specific/linux/atheros/r3122.nix
index 35abd621438d..020dce8a9a46 100644
--- a/pkgs/os-specific/linux/atheros/r3122.nix
+++ b/pkgs/os-specific/linux/atheros/r3122.nix
@@ -22,9 +22,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs [doMakeInstall postInstall
 			doForceShare doPropagate]);
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/atheros/r3574.nix b/pkgs/os-specific/linux/atheros/r3574.nix
index 486ae9fe80f3..c16fc1285ec0 100644
--- a/pkgs/os-specific/linux/atheros/r3574.nix
+++ b/pkgs/os-specific/linux/atheros/r3574.nix
@@ -22,9 +22,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs [doMakeInstall postInstall
 			doForceShare doPropagate]);
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/atheros/r3693.nix b/pkgs/os-specific/linux/atheros/r3693.nix
index 7561e07609a5..bf8456787dd1 100644
--- a/pkgs/os-specific/linux/atheros/r3693.nix
+++ b/pkgs/os-specific/linux/atheros/r3693.nix
@@ -35,9 +35,7 @@ stdenv.mkDerivation rec {
 			++ [doMakeInstall postInstall
 			doForceShare doPropagate]));
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/atheros/r3837.nix b/pkgs/os-specific/linux/atheros/r3837.nix
index ca475bfc3e1e..d7dbe98893cb 100644
--- a/pkgs/os-specific/linux/atheros/r3837.nix
+++ b/pkgs/os-specific/linux/atheros/r3837.nix
@@ -39,9 +39,7 @@ stdenv.mkDerivation rec {
 			++ [doPatch doMakeInstall postInstall
 			doForceShare doPropagate]));
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/atheros/r3867.nix b/pkgs/os-specific/linux/atheros/r3867.nix
index aaa708c2c5d5..62316d38b817 100644
--- a/pkgs/os-specific/linux/atheros/r3867.nix
+++ b/pkgs/os-specific/linux/atheros/r3867.nix
@@ -39,9 +39,7 @@ stdenv.mkDerivation rec {
 			++ [doPatch doMakeInstall postInstall
 			doForceShare doPropagate]));
 	meta = {
-		description = "
-		Atheros WiFi driver.
-";
+		description = "Atheros WiFi driver";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/cryptsetup/default.nix b/pkgs/os-specific/linux/cryptsetup/default.nix
new file mode 100644
index 000000000000..f7fee0705d94
--- /dev/null
+++ b/pkgs/os-specific/linux/cryptsetup/default.nix
@@ -0,0 +1,23 @@
+{stdenv, fetchurl, e2fsprogs, popt, devicemapper, udev }:
+
+stdenv.mkDerivation {
+  name = "cryptsetup-1.0.6";
+  src = fetchurl {
+    url = http://cryptsetup.googlecode.com/files/cryptsetup-1.0.6.tar.bz2;
+    sha256 = "df7fda80cfa01f063caf39140287a47d018dfe056fc71a3ba605e690ff0183fd";
+  };
+
+  configureFlags = [ "--enable-libdevmapper" ];
+
+  patchPhase = ''
+    sed -i -e 's@/sbin/udevsettle@${udev}/sbin/udevsettle@' lib/libdevmapper.c
+  '';
+
+  buildInputs = [ e2fsprogs popt devicemapper ];
+
+  meta = {
+    homepage = http://code.google.com/p/cryptsetup/;
+    description = "LUKS for dm-crypt";
+    license = "GPLv2";
+  };
+}
diff --git a/pkgs/os-specific/linux/dmidecode/2.9.nix b/pkgs/os-specific/linux/dmidecode/2.9.nix
index 65081d9f82e7..e0b46b35e4ef 100644
--- a/pkgs/os-specific/linux/dmidecode/2.9.nix
+++ b/pkgs/os-specific/linux/dmidecode/2.9.nix
@@ -16,9 +16,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [ doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		Tool to decode Desktop Management Interface and SBIOS data.
-";
+		description = "Tool to decode Desktop Management Interface and SBIOS data";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/kernel-headers/2.6.28.nix b/pkgs/os-specific/linux/kernel-headers/2.6.28.nix
index 082a65950ca8..3136f52db8e8 100644
--- a/pkgs/os-specific/linux/kernel-headers/2.6.28.nix
+++ b/pkgs/os-specific/linux/kernel-headers/2.6.28.nix
@@ -20,9 +20,6 @@ stdenv.mkDerivation {
 
   buildInputs = [perl];
 
-  # !!! hacky
-  fixupPhase = "ln -s $out/include/asm $out/include/asm-$platform";
-
   extraIncludeDirs =
     if stdenv.system == "powerpc-linux" then ["ppc"] else [];
 
@@ -41,4 +38,12 @@ stdenv.mkDerivation {
     ensureDir $out/include/config
     echo "${version}-default" > $out/include/config/kernel.release
   '';
+
+  # !!! hacky
+  fixupPhase = ''
+    ln -s asm $out/include/asm-$platform
+    if test "$platform" = "i386" -o "$platform" = "x86_64"; then
+      ln -s asm $out/include/asm-x86
+    fi  
+  '';
 }
diff --git a/pkgs/os-specific/linux/kernel/builder.sh b/pkgs/os-specific/linux/kernel/builder.sh
index 4e3461cc25ac..246bafb748d3 100644
--- a/pkgs/os-specific/linux/kernel/builder.sh
+++ b/pkgs/os-specific/linux/kernel/builder.sh
@@ -124,12 +124,10 @@ installPhase() {
         # copy include files
         includeDir=$out/lib/modules/$version/build/include
         mkdir -p $includeDir
-        (cd include && cp -a acpi config linux math-emu media net pcmcia rxrpc scsi sound video asm-generic $includeDir)
-        if test -e arch/$archDir/include/asm; then
-            cp -a arch/$archDir/include/asm $includeDir
-        else
-            cp -a include/asm-$archDir $includeDir/asm
-        fi
+        (cd include && cp -a acpi config linux math-emu media net pcmcia rxrpc scsi sound video asm-generic asm asm-$archDir $includeDir)
+	(cd arch/$archDir/include && cp -a * $includeDir || true)
+	(cd arch/$archDir/include && cp -a asm/* $includeDir/asm/ || true)
+	(cd arch/$archDir/include/asm/mach-generic && cp -a * $includeDir/ || true)
     fi
 }
 
diff --git a/pkgs/os-specific/linux/kernel/config-2.6.27-i686-smp b/pkgs/os-specific/linux/kernel/config-2.6.27-i686-smp
index 03c43e566c67..064b9187259e 100644
--- a/pkgs/os-specific/linux/kernel/config-2.6.27-i686-smp
+++ b/pkgs/os-specific/linux/kernel/config-2.6.27-i686-smp
@@ -3426,7 +3426,7 @@ CONFIG_SDIO_UART=m
 #
 # MMC/SD Host Controller Drivers
 #
-# CONFIG_MMC_SDHCI is not set
+CONFIG_MMC_SDHCI=m
 CONFIG_MMC_WBSD=m
 CONFIG_MMC_TIFM_SD=m
 CONFIG_MMC_SDRICOH_CS=m
diff --git a/pkgs/os-specific/linux/kernel/config-2.6.28-i686-smp b/pkgs/os-specific/linux/kernel/config-2.6.28-i686-smp
index 0e2cfc2fe066..aa5f90874bff 100644
--- a/pkgs/os-specific/linux/kernel/config-2.6.28-i686-smp
+++ b/pkgs/os-specific/linux/kernel/config-2.6.28-i686-smp
@@ -3553,7 +3553,7 @@ CONFIG_SDIO_UART=m
 #
 # MMC/SD/SDIO Host Controller Drivers
 #
-# CONFIG_MMC_SDHCI is not set
+CONFIG_MMC_SDHCI=m
 CONFIG_MMC_WBSD=m
 CONFIG_MMC_TIFM_SD=m
 CONFIG_MMC_SDRICOH_CS=m
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.27.nix b/pkgs/os-specific/linux/kernel/linux-2.6.27.nix
index f6632d95ace6..dfb704bc8297 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.27.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.27.nix
@@ -5,11 +5,11 @@ assert !userModeLinux;
 import ./generic.nix (
 
   rec {
-    version = "2.6.27.15";
+    version = "2.6.27.19";
   
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "17n8q425q5xix2fd1ig5gbpfjhy18wggd27pyaxi7vvxa9ihm969";
+      sha256 = "1xkl5dfj7lrdp4p0sjxi11qwzhjbxj08ww5hd70xfhsqyllrgzh9";
     };
 
     features = {
diff --git a/pkgs/os-specific/linux/kernel/linux-2.6.28.nix b/pkgs/os-specific/linux/kernel/linux-2.6.28.nix
index 628df9391a81..9982028b279d 100644
--- a/pkgs/os-specific/linux/kernel/linux-2.6.28.nix
+++ b/pkgs/os-specific/linux/kernel/linux-2.6.28.nix
@@ -5,11 +5,11 @@ assert !userModeLinux;
 import ./generic.nix (
 
   rec {
-    version = "2.6.28.4";
+    version = "2.6.28.7";
   
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v2.6/linux-${version}.tar.bz2";
-      sha256 = "1k45azdjv4i9hh76nbi442vsfpwz31736aq3la2pn5avmkwiz2mm";
+      sha256 = "1bck0gmkbrgskb5269j0sw5ww4103pfq83c0xzwmmznbfl6c9xls";
     };
 
     features = {
diff --git a/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix b/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix
index 54f197f3b5a2..d2f26cab8a37 100644
--- a/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix
+++ b/pkgs/os-specific/linux/kqemu/1.3.0pre11.nix
@@ -18,10 +18,21 @@ rec {
     cat install.sh
     sed -e '/linux\/ioctl.h/a#include <linux\/sched.h>' -i kqemu-linux.c
   '') ["minInit" "doUnpack"];
-
-  phaseNames = ["preConfigure" "doConfigure" "debugStep" "doMakeInstall"];
+  fixInc = {
+    text = ''
+      sed -e '/#include/i#include <linux/sched.h>' -i kqemu-linux.c
+    '';
+    deps = ["minInit" "doUnpack"];
+  };
+  fixMemFunc = {
+    text=''
+      sed -e 's/memset/mymemset/g; s/memcpy/mymemcpy/g; s/void [*]my/static void *my/g' -i common/kernel.c
+    '';
+    deps = ["minInit" "doUnpack"];
+  };
+  phaseNames = ["fixInc" "fixMemFunc" "preConfigure" "doConfigure" "debugStep" "doMakeInstall"];
 
   meta = {
-    description = " Kernel module for Qemu acceleration ";
+    description = "Kernel module for Qemu acceleration";
   }; 
 }
diff --git a/pkgs/os-specific/linux/kqemu/1.4.0pre1.nix b/pkgs/os-specific/linux/kqemu/1.4.0pre1.nix
index 7dad06c3d0e6..f23418bceea6 100644
--- a/pkgs/os-specific/linux/kqemu/1.4.0pre1.nix
+++ b/pkgs/os-specific/linux/kqemu/1.4.0pre1.nix
@@ -17,8 +17,19 @@ rec {
     sed -e '/depmod/d' -i install.sh
     cat install.sh
   '') ["minInit" "doUnpack"];
-
-  phaseNames = ["preConfigure" "doConfigure" "debugStep" "doMakeInstall"];
+  fixInc = {
+    text = ''
+      sed -e '/#include/i#include <linux/sched.h>' -i kqemu-linux.c
+    '';
+    deps = ["minInit" "doUnpack"];
+  };
+  fixMemFunc = {
+    text=''
+      sed -e 's/memset/mymemset/g; s/memcpy/mymemcpy/g; s/void [*]my/static void *my/g' -i common/kernel.c
+    '';
+    deps = ["minInit" "doUnpack"];
+  };
+  phaseNames = ["fixInc" "fixMemFunc" "preConfigure" "doConfigure" "debugStep" "doMakeInstall"];
 
   meta = {
     description = " Kernel module for Qemu acceleration ";
diff --git a/pkgs/os-specific/linux/kvm/82.nix b/pkgs/os-specific/linux/kvm/84.nix
index eb5db5c54247..a1830e4c203a 100644
--- a/pkgs/os-specific/linux/kvm/82.nix
+++ b/pkgs/os-specific/linux/kvm/84.nix
@@ -2,12 +2,12 @@
    
 assert stdenv.isLinux;
    
-stdenv.mkDerivation {
-  name = "kvm-82";
+stdenv.mkDerivation rec {
+  name = "kvm-84";
    
   src = fetchurl {
-    url = mirror://sourceforge/kvm/kvm-82.tar.gz;
-    sha256 = "1fk58g8z9v7z42vy76zq0sq28slqf8zszzmh73vyxm07vfbc96zs";
+    url = "mirror://sourceforge/kvm/${name}.tar.gz";
+    sha256 = "13lqhy4lpxqby7qj3l1cdbj73c7jmvkq73bc5wchwn0l0dkjsjlk";
   };
 
   patches = [
diff --git a/pkgs/os-specific/linux/nvidia/default.nix b/pkgs/os-specific/linux/nvidia/default.nix
index 4fe6529583ae..0b4d8b8988ed 100644
--- a/pkgs/os-specific/linux/nvidia/default.nix
+++ b/pkgs/os-specific/linux/nvidia/default.nix
@@ -39,5 +39,6 @@ stdenv.mkDerivation {
   meta = {
     homepage = http://www.nvidia.com/object/unix.html;
     description = "X.org driver and kernel module for NVIDIA graphics cards";
+    license = "unfree";
   };
 }
diff --git a/pkgs/os-specific/linux/powertop/default.nix b/pkgs/os-specific/linux/powertop/default.nix
index d50d6ce98371..ca04fc49d144 100644
--- a/pkgs/os-specific/linux/powertop/default.nix
+++ b/pkgs/os-specific/linux/powertop/default.nix
@@ -1,11 +1,11 @@
-{stdenv, fetchurl, ncurses}:
+{stdenv, fetchurl, ncurses, gettext}:
 
 stdenv.mkDerivation {
-  name = "powertop-1.9";
+  name = "powertop-1.11";
   src = fetchurl {
-    url = http://www.lesswatts.org/projects/powertop/download/powertop-1.9.tar.gz;
-    sha256 = "15150ra7n0q1nfij4ax3dnlplyjakm2ipx246xi3wsj3qc99m2a1";
+    url = http://www.lesswatts.org/projects/powertop/download/powertop-1.11.tar.gz;
+    sha256 = "1wl0c7sav5rf7andnx704vs3n5gj2b5g1adx8zjfbbgvwm9wrrvh";
   };
   patches = [./powertop-1.8.patch];
-  buildInputs = [ncurses];
+  buildInputs = [ncurses gettext];
 }
diff --git a/pkgs/os-specific/linux/sdparm/1.03.nix b/pkgs/os-specific/linux/sdparm/1.03.nix
index e11db22fff0a..9bc19954e037 100644
--- a/pkgs/os-specific/linux/sdparm/1.03.nix
+++ b/pkgs/os-specific/linux/sdparm/1.03.nix
@@ -15,9 +15,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	SCSI parameters utility.
-";
+		description = "Utility for setting parameters of SCSI devices";
 		inherit src;
 	};
 }
diff --git a/pkgs/os-specific/linux/tcp-wrapper/builder.sh b/pkgs/os-specific/linux/tcp-wrapper/builder.sh
index fe8ad8d466e5..6cb91110530c 100644
--- a/pkgs/os-specific/linux/tcp-wrapper/builder.sh
+++ b/pkgs/os-specific/linux/tcp-wrapper/builder.sh
@@ -1,37 +1,39 @@
 source "$stdenv/setup" || exit 1
 
 # Unpack
-unpackPhase &&							\
-cd "$sourceRoot/upstream/tarballs" &&				\
-tar xzvf * &&							\
-cd tcp_wrappers_7.6 &&						\
-								\
+unpackPhase
+cd "$sourceRoot/upstream/tarballs"
+tar xzvf *
+cd tcp_wrappers_7.6
+
 # Patch
+patchPhase
+for patch in debian/patches/*
+do
+  echo "applying Debian patch \`$(basename $patch)'..."
+  patch -p1 < $patch
+done
+
 substituteInPlace "Makefile" --replace				\
    "REAL_DAEMON_DIR=/usr/sbin" "REAL_DAEMON_DIR=$out/sbin"	\
-   --replace "/tmp" '$$TMPDIR' &&				\
-substituteInPlace "scaffold.c" --replace			\
-   'extern char *malloc();' " " &&				\
-substituteInPlace "environ.c" --replace				\
-   'extern char *malloc();' " " &&				\
-								\
-# The `linux' target doesn't work on Linux...
-echo building... &&						\
-make REAL_DAEMON_DIR="$out/sbin" freebsd &&			\
-								\
+   --replace "/tmp" '$$TMPDIR'
+
+echo "building..."
+make REAL_DAEMON_DIR="$out/sbin" linux
+
 # Install
-ensureDir "$out/sbin" &&					\
-cp safe_finger tcpd tcpdchk tcpdmatch try-from "$out/sbin" &&	\
-								\
-ensureDir "$out/lib" &&						\
-cp lib*.a "$out/lib" &&						\
-								\
-ensureDir "$out/include" &&					\
-cp *.h "$out/include" && 					\
-								\
-ensureDir "$out/man" &&						\
-for i in 3 5 8;							\
-do								\
-  ensureDir "$out/man/man$i" &&					\
-  cp *.$i "$out/man/man$i" ;					\
-done								\
+ensureDir "$out/sbin"
+cp -v safe_finger tcpd tcpdchk tcpdmatch try-from "$out/sbin"
+
+ensureDir "$out/lib"
+cp -v shared/lib*.so* "$out/lib"
+
+ensureDir "$out/include"
+cp -v *.h "$out/include"
+
+ensureDir "$out/man"
+for i in 3 5 8;
+do
+  ensureDir "$out/man/man$i"
+  cp *.$i "$out/man/man$i" ;
+done
diff --git a/pkgs/os-specific/linux/tcp-wrapper/default.nix b/pkgs/os-specific/linux/tcp-wrapper/default.nix
index d5984e649a5e..a3f79cd05a85 100644
--- a/pkgs/os-specific/linux/tcp-wrapper/default.nix
+++ b/pkgs/os-specific/linux/tcp-wrapper/default.nix
@@ -7,8 +7,32 @@ stdenv.mkDerivation {
     url = mirror://debian/pool/main/t/tcp-wrappers/tcp-wrappers_7.6.dbs.orig.tar.gz;
     sha256 = "0k68ziinx6biwar5lcb9jvv0rp6b3vmj6861n75bvrz4w1piwkdp";
   };
-  
+
+  patches = [
+    (fetchurl {
+       url = mirror://debian/pool/main/t/tcp-wrappers/tcp-wrappers_7.6.dbs-13.diff.gz;
+       sha256 = "071ir20rh8ckhgrc0y99wgnlbqjgkprf0qwbv84lqw5i6qajbcnh";
+     })
+  ];
+
   builder = ./builder.sh;
 
-  # meta = ...
+  meta = {
+    description = "TCP Wrappers, a network logger, also known as TCPD or LOG_TCP";
+
+    longDescription = ''
+      Wietse Venema's network logger, also known as TCPD or LOG_TCP.
+      These programs log the client host name of incoming telnet, ftp,
+      rsh, rlogin, finger etc. requests.  Security options are: access
+      control per host, domain and/or service; detection of host name
+      spoofing or host address spoofing; booby traps to implement an
+      early-warning system.  The current version supports the System
+      V.4 TLI network programming interface (Solaris, DG/UX) in
+      addition to the traditional BSD sockets.
+    '';
+
+    homepage = ftp://ftp.porcupine.org/pub/security/index.html;
+
+    license = "BSD-style";
+  };
 }
diff --git a/pkgs/os-specific/linux/tunctl/default.nix b/pkgs/os-specific/linux/tunctl/default.nix
new file mode 100644
index 000000000000..f4c3aad938f2
--- /dev/null
+++ b/pkgs/os-specific/linux/tunctl/default.nix
@@ -0,0 +1,21 @@
+{stdenv, fetchurl}:
+
+stdenv.mkDerivation {
+  name = "tunctl-1.5";
+  src = fetchurl {
+    url = mirror://sourceforge/tunctl/tunctl-1.5.tar.gz;
+    sha256 = "aa2a6c4cc6bfacb11e0d9f62334a6638a0d435475c61230116f00b6af8b14fff";
+  };
+
+  makeFlags = [ "tunctl" ];
+  installPhase = ''
+    ensureDir $out/bin
+    cp tunctl $out/bin
+  '';
+
+  meta = {
+    homepage = http://tunctl.sourceforge.net/;
+    description = "Utility to set up and maintain TUN/TAP network interfaces";
+    license = "GPLv2";
+  };
+}
diff --git a/pkgs/servers/dict/1.9.15.nix b/pkgs/servers/dict/1.9.15.nix
index 2886bb24ae9b..9eb0fe3dff9d 100644
--- a/pkgs/servers/dict/1.9.15.nix
+++ b/pkgs/servers/dict/1.9.15.nix
@@ -16,9 +16,7 @@ stdenv.mkDerivation rec {
                 (textClosure localDefs 
                         [doConfigure doMakeInstall doForceShare doPropagate]);
         meta = {
-                description = "
-                Dict protocol server and client.
-";
+                description = "Dict protocol server and client";
                 inherit src;
         };
 }
diff --git a/pkgs/servers/dict/dictd-db.nix b/pkgs/servers/dict/dictd-db.nix
index 9eb89361c356..6b981f0c4de7 100644
--- a/pkgs/servers/dict/dictd-db.nix
+++ b/pkgs/servers/dict/dictd-db.nix
@@ -23,9 +23,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[doInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		${name} dictionary for dictd.
-";
+		description = "${name} dictionary for dictd";
 		inherit src;
 	};
 };
diff --git a/pkgs/servers/gpm/1.20.3pre6.nix b/pkgs/servers/gpm/1.20.6.nix
index fd7a5a2382f9..6343234803d8 100644
--- a/pkgs/servers/gpm/1.20.3pre6.nix
+++ b/pkgs/servers/gpm/1.20.6.nix
@@ -1,8 +1,8 @@
 args : with args; 
 rec {
   src = fetchurl {
-    url = http://linux.schottelius.org/gpm/archives/releases-2008/gpm-1.20.3pre6.tar.lzma;
-    sha256 = "0sps9987w7daxfkbavzyi694n7ggf1wd5lh81nwka87m90q7rah7";
+    url = http://linux.schottelius.org/gpm/archives/gpm-1.20.6.tar.lzma;
+    sha256 = "13w61bh9nyjaa0n5a7qq1rvbqxjbxpqz5qmdmqqpqgrd2jlviar7";
   };
 
   buildInputs = [lzma flex bison ncurses];
diff --git a/pkgs/servers/irc/ircd-hybrid/default.nix b/pkgs/servers/irc/ircd-hybrid/default.nix
index 572cc28e55b3..e428f4d649f7 100644
--- a/pkgs/servers/irc/ircd-hybrid/default.nix
+++ b/pkgs/servers/irc/ircd-hybrid/default.nix
@@ -1,4 +1,5 @@
 args: with args;
+
 stdenv.mkDerivation {
   name = "ircd-hybrid-7.2.2";
 
@@ -9,15 +10,12 @@ stdenv.mkDerivation {
 
   buildInputs = [openssl zlib];
 
-  configureFlags =  ["--with-nicklen=100" 
-	"--with-topiclen=360" 
-	("--enable-openssl=" + openssl)];
+  configureFlags =
+    "--with-nicklen=100 --with-topiclen=360 --enable-openssl=${openssl}";
 
   preInstall = "mkdir -p \${out}/ ; ln -s /home/ircd \${out}/logs;";
 
   meta = {
-    description = "
-	An IPv6-capable IRC server.
-";
+    description = "An IPv6-capable IRC server";
   };
 }
diff --git a/pkgs/servers/sql/mysql5/default.nix b/pkgs/servers/sql/mysql5/default.nix
index 89107d108646..d8f3559ed35b 100644
--- a/pkgs/servers/sql/mysql5/default.nix
+++ b/pkgs/servers/sql/mysql5/default.nix
@@ -3,11 +3,11 @@ args: with args;
 # Note: zlib is not required; MySQL can use an internal zlib.
 
 stdenv.mkDerivation {
-  name = "mysql-5.0.45";
+  name = "mysql-5.0.77";
 
   src = fetchurl {
-    url = http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.45.tar.gz;
-    sha256 = "e4443d8dc859ed53bd9f3bef143ce30c7f5dee66a02748e9a003136be25e0060";
+    url = http://downloads.mysql.com/archives/mysql-5.0/mysql-5.0.77.tar.gz;
+    sha256 = "1s0m991aynim8ny28cfwhjw0ly8j5d72xi00461w6yc2hlaijcd9";
   };
 
   buildInputs = [ps ncurses zlib perl openssl];
diff --git a/pkgs/servers/squid/squids.nix b/pkgs/servers/squid/squids.nix
index beffef173366..45d289537cea 100644
--- a/pkgs/servers/squid/squids.nix
+++ b/pkgs/servers/squid/squids.nix
@@ -1,38 +1,36 @@
 args: with args;
 let edf = composableDerivation.edf; in
 rec {
-  squid30 = composableDerivation.composableDerivation {
-    initial = {
-      name = "squid-3.0-stable5";
+  squid30 = composableDerivation.composableDerivation {} {
+    name = "squid-3.0-stable5";
 
-      buildInputs = [perl];
+    buildInputs = [perl];
 
-      src = args.fetchurl {
-        url = http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE5.tar.bz2;
-        sha256 = "1m4ccpjw30q9vwsycmgg9dmhly0mpznvxrch6f7dxgfzpjp26l7w";
-      };
-
-      configureFlags = ["--enable-ipv6"];
+    src = args.fetchurl {
+      url = http://www.squid-cache.org/Versions/v3/3.0/squid-3.0.STABLE5.tar.bz2;
+      sha256 = "1m4ccpjw30q9vwsycmgg9dmhly0mpznvxrch6f7dxgfzpjp26l7w";
+    };
 
-      meta = {
-        description = "http-proxy";
-        homepage = "http://www.squid-cache.org";
-        license = "GPL2";
-      };
+    configureFlags = ["--enable-ipv6"];
 
+    meta = {
+      description = "http-proxy";
+      homepage = "http://www.squid-cache.org";
+      license = "GPL2";
     };
+
   };
 
-  squid3Beta = squid30.passthru.funMerge {
+  squid3Beta = squid30.merge {
     name = "squid-3.1-beta";
     src = args.fetchurl {
-      url = http://www.squid-cache.org/Versions/v3/3.1/squid-3.1.0.3.tar.bz2;
-      sha256 = "0khc4w9sbdwzxw8285z60ymz15q5qjy7b8yvvfnzfkihdacs735x";
+      url = http://www.squid-cache.org/Versions/v3/3.1/squid-3.1.0.6.tar.bz2;
+      sha256 = "0crkfd5kc677baq0v6kfnwh0rc7h2a1083yh0sccy7g02vd7z3q5";
     };
     configureFlags = ["--enable-ipv6"];
   };
 
-  squid3Head = squid3Beta.passthru.funMerge {
+  squid3Head = squid3Beta.merge {
     name = "squid-3.1-HEAD";
     src = args.fetchurl {
       url = http://www.squid-cache.org/Versions/v3/3.1/squid-3.1.0.3-20081221.tar.bz2;
diff --git a/pkgs/servers/xmpp/openfire/3.4.5.nix b/pkgs/servers/xmpp/openfire/3.4.5.nix
index 3bb69b373419..a8d7360d8d64 100644
--- a/pkgs/servers/xmpp/openfire/3.4.5.nix
+++ b/pkgs/servers/xmpp/openfire/3.4.5.nix
@@ -26,9 +26,7 @@ stdenv.mkDerivation rec {
     (textClosure localDefs 
       [ installPhase doForceShare doPropagate]);
   meta = {
-    description = "
-    XMPP server in Java.
-";
-		inherit src;
+    description = "XMPP server in Java";
+    inherit src;
   };
 }
diff --git a/pkgs/servers/xmpp/openfire/3.5.2.nix b/pkgs/servers/xmpp/openfire/3.5.2.nix
index 23f6f348a11b..30e44b5771f5 100644
--- a/pkgs/servers/xmpp/openfire/3.5.2.nix
+++ b/pkgs/servers/xmpp/openfire/3.5.2.nix
@@ -26,9 +26,7 @@ stdenv.mkDerivation rec {
     (textClosure localDefs 
       [ installPhase doForceShare doPropagate]);
   meta = {
-    description = "
-    XMPP server in Java.
-";
-		inherit src;
+    description = "XMPP server in Java";
+    inherit src;
   };
 }
diff --git a/pkgs/tools/X11/x11vnc/0.9.3.nix b/pkgs/tools/X11/x11vnc/0.9.3.nix
index 3452d3f893ba..76b096734512 100644
--- a/pkgs/tools/X11/x11vnc/0.9.3.nix
+++ b/pkgs/tools/X11/x11vnc/0.9.3.nix
@@ -18,11 +18,9 @@ stdenv.mkDerivation rec {
     (textClosure localDefs 
       [doConfigure doMakeInstall doForceShare doPropagate]);
   meta = {
-    description = "
-    X11 VNC - VNC server connected to real X11 screen.
-";
+    description = "A VNC server connected to a real X11 screen";
     homepage = "http://www.karlrunge.com/x11vnc/";
-		inherit src;
+    inherit src;
   };
 }
 
diff --git a/pkgs/tools/X11/x2vnc/1.7.2.nix b/pkgs/tools/X11/x2vnc/1.7.2.nix
index 917995b719d4..0d805b44ac24 100644
--- a/pkgs/tools/X11/x2vnc/1.7.2.nix
+++ b/pkgs/tools/X11/x2vnc/1.7.2.nix
@@ -20,9 +20,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[doConfigure doCreatePrefix doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		x2vnc - program to control remote VNC server.
-";
+		description = "A program to control a remote VNC server";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/admin/tightvnc/default.nix b/pkgs/tools/admin/tightvnc/default.nix
index ad8fa50a299c..16a0e5dc6cb8 100644
--- a/pkgs/tools/admin/tightvnc/default.nix
+++ b/pkgs/tools/admin/tightvnc/default.nix
@@ -1,5 +1,8 @@
 {stdenv, fetchurl, x11, zlib, libjpeg, imake, gccmakedep, libXmu, libXaw, libXpm, libXp , perl, xauth}:
 
+# if you have any trouble connecting to the tightvnc server try $ rm ~/.Xauthority
+# Dunno what happens here but it works.
+
 stdenv.mkDerivation {
   name = "tightvnc-1.3.9";
   builder = ./builder.sh;
diff --git a/pkgs/tools/backup/rsnapshot/default.nix b/pkgs/tools/backup/rsnapshot/default.nix
index c79be7cffb45..a9cba3f7deec 100644
--- a/pkgs/tools/backup/rsnapshot/default.nix
+++ b/pkgs/tools/backup/rsnapshot/default.nix
@@ -15,8 +15,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = {
-    description = ''rsnapshot is a filesystem snapshot utility for making
-                    backups of local and remote systems.'';
+    description = "A filesystem snapshot utility for making backups of local and remote systems";
     homepage = http://rsnapshot.org/;
     license = "GPLv2+";
   };
diff --git a/pkgs/tools/graphics/graphviz/default.nix b/pkgs/tools/graphics/graphviz/default.nix
index 93a98891d135..8ec11e7ca9e4 100644
--- a/pkgs/tools/graphics/graphviz/default.nix
+++ b/pkgs/tools/graphics/graphviz/default.nix
@@ -4,12 +4,12 @@
 
 assert libpng != null && libjpeg != null && expat != null;
 
-stdenv.mkDerivation {
-  name = "graphviz-2.20.2";
+stdenv.mkDerivation rec {
+  name = "graphviz-2.20.3";
 
   src = fetchurl {
-    url = http://www.graphviz.org/pub/graphviz/ARCHIVE/graphviz-2.20.2.tar.gz;
-    sha256 = "13mw0mhr4n14c5q7a6c44cvggl5hiqbx53ynr53s67rldvzcilgm";
+    url = "http://www.graphviz.org/pub/graphviz/ARCHIVE/${name}.tar.gz";
+    sha256 = "0grrijj3ryacnc0qj8l6xp5nqnmff5nvx6ziij1r9lghzb17cdjq";
   };
 
   buildInputs = [pkgconfig x11 libpng libjpeg expat libXaw yacc libtool fontconfig pango gd];
diff --git a/pkgs/tools/graphics/netpbm/default.nix b/pkgs/tools/graphics/netpbm/default.nix
new file mode 100644
index 000000000000..dc4b3ce95bbc
--- /dev/null
+++ b/pkgs/tools/graphics/netpbm/default.nix
@@ -0,0 +1,38 @@
+{stdenv, fetchsvn, libjpeg, libpng, flex, zlib, perl, libxml2 }:
+
+stdenv.mkDerivation {
+  name = "netpbm-advanced-844";
+
+  src = fetchsvn {
+    url = https://netpbm.svn.sourceforge.net/svnroot/netpbm/advanced;
+    rev = 844;
+  };
+
+  buildInputs = [ flex zlib perl libpng libjpeg libxml2 ];
+
+  configurePhase = "cp config.mk.in config.mk";
+
+  installPhase = ''
+    make package pkgdir=$PWD/netpbmpkg
+    # Pass answers to the script questions
+    ./installnetpbm << EOF
+    $PWD/netpbmpkg
+    $out
+    Y
+    $out/bin
+    $out/lib
+    N
+    $out/lib
+    $out/lib
+    $out/include
+    $out/man
+    N
+    EOF
+  '';
+
+  meta = {
+    homepage = http://netpbm.sourceforge.net/;
+    description = "Toolkit for manipulation of graphic images";
+    license = "GPL,free";
+  };
+}
diff --git a/pkgs/tools/graphics/ploticus/default.nix b/pkgs/tools/graphics/ploticus/default.nix
index 3efb7eab881e..f173f2f1e140 100644
--- a/pkgs/tools/graphics/ploticus/default.nix
+++ b/pkgs/tools/graphics/ploticus/default.nix
@@ -14,8 +14,7 @@ stdenv.mkDerivation {
   patches = [./ploticus-install.patch];
 
   meta = {
-    description = ''Ploticus, a non-interactive software package for
-                    producing plots and charts'';
+    description = "A non-interactive software package for producing plots and charts";
 
     longDescription = ''Ploticus is a free, GPL'd, non-interactive
       software package for producing plots, charts, and graphics from
diff --git a/pkgs/tools/misc/bogofilter/default.nix b/pkgs/tools/misc/bogofilter/default.nix
index 67382191da53..f23bd8993cff 100644
--- a/pkgs/tools/misc/bogofilter/default.nix
+++ b/pkgs/tools/misc/bogofilter/default.nix
@@ -14,11 +14,13 @@ stdenv.mkDerivation rec {
 
   meta = {
     homepage = http://bogofilter.sourceforge.net/;
-    description = ''Bogofilter is a mail filter that classifies mail
-                    as spam or ham (non-spam) by a statistical analysis of
-		    the message's header and content (body).  The program is
-		    able to learn from the user's classifications and
-		    corrections.  It is based on a Bayesian filter.'';
+    longDescription = ''
+      Bogofilter is a mail filter that classifies mail as spam or ham
+      (non-spam) by a statistical analysis of the message's header and
+      content (body).  The program is able to learn from the user's
+      classifications and corrections.  It is based on a Bayesian
+      filter.
+    '';
     license = "GPLv2";
   };
 }
diff --git a/pkgs/tools/misc/desktop-file-utils/default.nix b/pkgs/tools/misc/desktop-file-utils/default.nix
new file mode 100644
index 000000000000..fd63016ddb88
--- /dev/null
+++ b/pkgs/tools/misc/desktop-file-utils/default.nix
@@ -0,0 +1,10 @@
+{stdenv, fetchurl, pkgconfig, glib}:
+
+stdenv.mkDerivation {
+  name = "desktop-file-utils-0.15";
+  src = fetchurl {
+    url = http://www.freedesktop.org/software/desktop-file-utils/releases/desktop-file-utils-0.15.tar.gz;
+    md5 = "2fe8ebe222fc33cd4a959415495b7eed";
+  };
+  buildInputs = [ pkgconfig glib ];
+}
diff --git a/pkgs/tools/misc/idutils/default.nix b/pkgs/tools/misc/idutils/default.nix
index 0b77921e3492..e1e4cf01ad37 100644
--- a/pkgs/tools/misc/idutils/default.nix
+++ b/pkgs/tools/misc/idutils/default.nix
@@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
+  patches = [ ./nix-mapping.patch ];
+
   meta = {
     description = "GNU Idutils, a text searching utility";
 
diff --git a/pkgs/tools/misc/idutils/nix-mapping.patch b/pkgs/tools/misc/idutils/nix-mapping.patch
new file mode 100644
index 000000000000..43e7439e2f60
--- /dev/null
+++ b/pkgs/tools/misc/idutils/nix-mapping.patch
@@ -0,0 +1,10 @@
+diff --git a/libidu/id-lang.map b/libidu/id-lang.map
+index 7edb860..6dccd28 100644
+--- a/libidu/id-lang.map
++++ b/libidu/id-lang.map
+@@ -92,3 +92,5 @@ Makefile.*		make
+ 
+ *.gz			FILTER gzip -d <%s
+ *.Z			FILTER gzip -d <%s
++
++*.nix			text
diff --git a/pkgs/tools/misc/parted/default.nix b/pkgs/tools/misc/parted/default.nix
index d135a63dd949..d256eda7a4b0 100644
--- a/pkgs/tools/misc/parted/default.nix
+++ b/pkgs/tools/misc/parted/default.nix
@@ -1,12 +1,22 @@
 {stdenv, fetchurl, e2fsprogs, readline}:
 
 stdenv.mkDerivation {
-  name = "parted-1.8.7";
+  name = "parted-1.8.8";
   src = fetchurl {
-    url = mirror://gnu/parted/parted-1.8.7.tar.bz2;
-    sha256 = "0njabfinn1kbkdx80gayqanpammnl28pklli34bymhx1sxn82kk3";
+    url = mirror://gnu/parted/parted-1.8.8.tar.bz2;
+    sha256 = "1sn5qcdi4pvxnxz8ryh5p52qmqd72qbk0d0a65pksxf7khd83kfz";
   };
   buildInputs = [e2fsprogs readline];
 
+  preConfigure=''
+    export CFLAGS=-fgnu89-inline
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -fgnu89-inline"
+  '';
   configureFlags = "--without-readline";
+
+  meta = {
+    description = "industrial-strength package for creating, destroying, resizing, checking and copying partitions";
+    homepage = http://www.gnu.org/software/parted/;
+    license = "GPLv3";
+  };
 }
diff --git a/pkgs/tools/misc/relfs/cvs.2007.12.01.nix b/pkgs/tools/misc/relfs/cvs.2007.12.01.nix
index 3f7aae91f344..0638331dbe21 100644
--- a/pkgs/tools/misc/relfs/cvs.2007.12.01.nix
+++ b/pkgs/tools/misc/relfs/cvs.2007.12.01.nix
@@ -44,9 +44,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [build doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	Relational FS over FUSE.
-";
+		description = "A relational filesystem on top of FUSE";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/misc/relfs/cvs.2008.03.05.nix b/pkgs/tools/misc/relfs/cvs.2008.03.05.nix
index 90275c1b32f1..4f3627f19e33 100644
--- a/pkgs/tools/misc/relfs/cvs.2008.03.05.nix
+++ b/pkgs/tools/misc/relfs/cvs.2008.03.05.nix
@@ -45,9 +45,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [build doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	Relational FS over FUSE.
-";
+		description = "A relational filesystem on top of FUSE";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/misc/remind/default.nix b/pkgs/tools/misc/remind/default.nix
new file mode 100644
index 000000000000..9a88d7a979f2
--- /dev/null
+++ b/pkgs/tools/misc/remind/default.nix
@@ -0,0 +1,15 @@
+{stdenv, fetchurl} :
+
+stdenv.mkDerivation {
+  name = "remind-3.1.6";
+  src = fetchurl {
+    url = http://www.roaringpenguin.com/files/download/remind-03.01.06.tar.gz;
+    sha256 = "acdf73904c95de55b615d80c7c007abe58d75e41978a16a43333a22583ac7738";
+  };
+
+  meta = {
+    homepage = http://www.roaringpenguin.com/products/remind;
+    description = "Sophisticated calendar and alarm program for the console";
+    license = "GPLv2";
+  };
+}
diff --git a/pkgs/tools/misc/rlwrap/0.28.nix b/pkgs/tools/misc/rlwrap/0.28.nix
index c694109c2e85..1bd453755102 100644
--- a/pkgs/tools/misc/rlwrap/0.28.nix
+++ b/pkgs/tools/misc/rlwrap/0.28.nix
@@ -16,9 +16,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			[doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		Readline wrapper for console programs.
-";
+		description = "Readline wrapper for console programs";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/misc/system-config-printer/default.nix b/pkgs/tools/misc/system-config-printer/default.nix
new file mode 100644
index 000000000000..05531482c795
--- /dev/null
+++ b/pkgs/tools/misc/system-config-printer/default.nix
@@ -0,0 +1,16 @@
+{stdenv, fetchurl, perl, perlXMLParser, autoconf, automake, intltool, gettext, desktop_file_utils}:
+
+stdenv.mkDerivation {
+  name = "system-config-printer-0.9.93";
+  src = fetchurl {
+    url = http://cyberelk.net/tim/data/system-config-printer/system-config-printer-0.9.93.tar.bz2;
+    md5 = "b97deae648bc1c5825874d250a9c140c";
+  };
+  patchPhase = ''
+    sed -i -e "s/xmlto/echo xmlto/" Makefile.am # Disable building manual pages
+    echo > man/system-config-printer.1
+    echo > man/system-config-printer-applet.1
+    ./bootstrap
+  ''; 
+  buildInputs = [ perl perlXMLParser autoconf automake intltool gettext desktop_file_utils ];
+}
diff --git a/pkgs/tools/misc/testdisk/default.nix b/pkgs/tools/misc/testdisk/default.nix
index fa3a54f6195e..fd9f45782940 100644
--- a/pkgs/tools/misc/testdisk/default.nix
+++ b/pkgs/tools/misc/testdisk/default.nix
@@ -13,10 +13,10 @@ stdenv.mkDerivation {
   meta = {
     homepage = http://www.cgsecurity.org/wiki/TestDisk;
     license = "GPL";
-    description = "
+    longDescription = ''
       TestDisk is a program for data recovery, primarily designed to
       help recover lost partitions and/or make non-booting disks
-      bootable again
-    ";
+      bootable again.
+    '';
   };
 }
diff --git a/pkgs/tools/misc/timidity/default.nix b/pkgs/tools/misc/timidity/default.nix
index d32f25e50b6b..3aa9247742b5 100644
--- a/pkgs/tools/misc/timidity/default.nix
+++ b/pkgs/tools/misc/timidity/default.nix
@@ -1,4 +1,5 @@
 args: with args;
+
 stdenv.mkDerivation {
   name = "timidity-2.13.0";
 
@@ -7,25 +8,21 @@ stdenv.mkDerivation {
     sha256 = "1jbmk0m375fh5nj2awqzns7pdjbi7dxpjdwcix04zipfcilppbmf";
   };
 
-  instruments = 
-	fetchurl {
-		url = http://www.csee.umbc.edu/pub/midia/instruments.tar.gz;
-		sha256 = "0lsh9l8l5h46z0y8ybsjd4pf6c22n33jsjvapfv3rjlfnasnqw67";
-	};
-
-  buildInputs =[alsaLib];
+  instruments = fetchurl {
+    url = http://www.csee.umbc.edu/pub/midia/instruments.tar.gz;
+    sha256 = "0lsh9l8l5h46z0y8ybsjd4pf6c22n33jsjvapfv3rjlfnasnqw67";
+  };
 
-  config=./timidity.cfg;
+  buildInputs = [alsaLib];
 
-  postInstall = "mkdir -p \$out/share/timidity/; 
-		cp \$config \$out/share/timidity/timidity.cfg; 
-		tar -xf \$instruments -C \$out/share/timidity/; 
-	";
+  postInstall = ''
+    mkdir -p $out/share/timidity/;
+    cp ${./timidity.cfg} $out/share/timidity/timidity.cfg
+    tar -xf $instruments -C $out/share/timidity/
+  '';
 
   meta = {
-    description = "
-	TiMidity - software MIDI renderer.
-";
+    description = "A software MIDI renderer";
   };
 }
 
diff --git a/pkgs/tools/misc/wv/default.nix b/pkgs/tools/misc/wv/default.nix
index 9fe71248e8d3..361a7b927b12 100644
--- a/pkgs/tools/misc/wv/default.nix
+++ b/pkgs/tools/misc/wv/default.nix
@@ -1,18 +1,16 @@
 args: with args;
+
 stdenv.mkDerivation {
   name = "wv-1.2.4";
 
   src = fetchurl {
-		url = mirror://sourceforge/wvware/wv-1.2.4.tar.gz;
-		sha256 = "1mn2ax6qjy3pvixlnvbkn6ymy6y4l2wxrr4brjaczm121s8hjcb7";
-	};
+    url = mirror://sourceforge/wvware/wv-1.2.4.tar.gz;
+    sha256 = "1mn2ax6qjy3pvixlnvbkn6ymy6y4l2wxrr4brjaczm121s8hjcb7";
+  };
 
-  buildInputs = [zlib imagemagick libpng glib
-	pkgconfig libgsf libxml2 bzip2];
+  buildInputs = [zlib imagemagick libpng glib pkgconfig libgsf libxml2 bzip2];
 
   meta = {
-    description = "
-	Convertor from Microsoft Word formats to human-editable ones.
-";
+    description = "Converter from Microsoft Word formats to human-editable ones";
   };
 }
diff --git a/pkgs/tools/networking/lsh/default.nix b/pkgs/tools/networking/lsh/default.nix
index 85e0c91a003d..6ca16e79db2b 100644
--- a/pkgs/tools/networking/lsh/default.nix
+++ b/pkgs/tools/networking/lsh/default.nix
@@ -7,11 +7,20 @@ stdenv.mkDerivation {
     sha256 = "614b9d63e13ad3e162c82b6405d1f67713fc622a8bc11337e72949d613713091";
   };
 
+  patches = [ ./pam-service-name.patch ];
+
   buildInputs = [gperf guile gmp zlib liboop gnum4 pam];
 
   meta = {
     description = "GNU lsh, a GPL'd implementation of the SSH protocol";
+
+    longDescription = ''
+      lsh is a free implementation (in the GNU sense) of the ssh
+      version 2 protocol, currently being standardised by the IETF
+      SECSH working group.
+    '';
+    
     homepage = http://www.lysator.liu.se/~nisse/lsh/;
-    license = "GPL";
+    license = "GPLv2+";
   };
 }
diff --git a/pkgs/tools/networking/lsh/pam-service-name.patch b/pkgs/tools/networking/lsh/pam-service-name.patch
new file mode 100644
index 000000000000..6a6156855c51
--- /dev/null
+++ b/pkgs/tools/networking/lsh/pam-service-name.patch
@@ -0,0 +1,14 @@
+Tell `lsh-pam-checkpw', the PAM password helper program, to use a more
+descriptive service name.
+
+--- lsh-2.0.4/src/lsh-pam-checkpw.c	2003-02-16 22:30:10.000000000 +0100
++++ lsh-2.0.4/src/lsh-pam-checkpw.c	2008-11-28 16:16:58.000000000 +0100
+@@ -38,7 +38,7 @@
+ #include <security/pam_appl.h>
+ 
+ #define PWD_MAXLEN 1024
+-#define SERVICE_NAME "other"
++#define SERVICE_NAME "lshd"
+ #define TIMEOUT 600 
+ 
+ static int
diff --git a/pkgs/tools/networking/nc6/1.0.nix b/pkgs/tools/networking/nc6/1.0.nix
index 4ea5578abed4..b6155c7a053f 100644
--- a/pkgs/tools/networking/nc6/1.0.nix
+++ b/pkgs/tools/networking/nc6/1.0.nix
@@ -16,9 +16,7 @@ stdenv.mkDerivation rec {
     (textClosure localDefs 
      [doConfigure doMakeInstall doForceShare doPropagate]);
   meta = {
-    description = "
-      nc6 - one more netcat, IPv6 support included.
-    ";
+    description = "A netcat implementation with IPv6 support";
     homepage = "http://www.deepspace6.net/projects/netcat6.html";
     inherit src;
   };
diff --git a/pkgs/tools/networking/ncat/default.nix b/pkgs/tools/networking/ncat/default.nix
index cc3ad321de8e..8f81e9284b60 100644
--- a/pkgs/tools/networking/ncat/default.nix
+++ b/pkgs/tools/networking/ncat/default.nix
@@ -1,4 +1,5 @@
 {stdenv, fetchurl, openssl}:
+
 stdenv.mkDerivation {
   name = "ncat-0.10rc3";
 
@@ -7,18 +8,18 @@ stdenv.mkDerivation {
     sha256 = "1yb26ipxwhqkfannji90jxi38k35fal4ffx0jm5clr1a1rndjjzb";
   };
 
-  patches = [./ncat-0.10rc3.patch ];
+  patches = [./ncat-0.10rc3.patch];
 
-  buildInputs = [openssl ];
+  buildInputs = [openssl];
 
   CFLAGS = "-g";
 
-  postInstall = "install -D ncat \${out}/bin/ncat ; 
-	install -D docs/man/ncat.1 \${out}/man/ncat.1 ;";
+  postInstall = ''
+    install -D ncat $out/bin/ncat
+    install -D docs/man/ncat.1 $out/man/ncat.1
+  '';
 
   meta = {
-    description = "
-	Ncat - some effort to join features from different `netcat's. Supports IPv6.
-";
+    description = "A netcat implementation with IPv6 support";
   };
 }
diff --git a/pkgs/tools/networking/nylon/default.nix b/pkgs/tools/networking/nylon/default.nix
new file mode 100644
index 000000000000..3d1563f9520d
--- /dev/null
+++ b/pkgs/tools/networking/nylon/default.nix
@@ -0,0 +1,19 @@
+{stdenv, fetchurl, libevent} :
+
+stdenv.mkDerivation {
+  name = "nylon-1.21";
+  src = fetchurl {
+    url = http://monkey.org/~marius/nylon/nylon-1.21.tar.gz;
+    sha256 = "34c132b005c025c1a5079aae9210855c80f50dc51dde719298e1113ad73408a4";
+  };
+
+  configureFlags = [ "--with-libevent=${libevent}" ];
+
+  buildInputs = [ libevent ];
+
+  meta = {
+    homepage = http://monkey.org/~marius/nylon;
+    description = "Proxy server, supporting SOCKS 4 and 5, as well as a mirror mode.";
+    license = "free";
+  };
+}
diff --git a/pkgs/tools/networking/p2p/libtorrent/default.nix b/pkgs/tools/networking/p2p/libtorrent/default.nix
index d8cdc26fd38c..50acf00678f9 100644
--- a/pkgs/tools/networking/p2p/libtorrent/default.nix
+++ b/pkgs/tools/networking/p2p/libtorrent/default.nix
@@ -13,8 +13,6 @@ stdenv.mkDerivation ( rec {
   buildInputs = [ pkgconfig openssl libsigcxx ];
   
   meta = {
-    description = "
-      LibTorrent is a BitTorrent library written in C++ for *nix, with a focus on high performance and good code.
-    ";
+    description = "A BitTorrent library written in C++ for *nix, with a focus on high performance and good code";
   };
 })
diff --git a/pkgs/tools/networking/p2p/rtorrent/default.nix b/pkgs/tools/networking/p2p/rtorrent/default.nix
index 04b50f9d5d25..2999da115fb0 100644
--- a/pkgs/tools/networking/p2p/rtorrent/default.nix
+++ b/pkgs/tools/networking/p2p/rtorrent/default.nix
@@ -13,8 +13,6 @@ stdenv.mkDerivation ( rec {
   buildInputs = [ libtorrent ncurses pkgconfig libsigcxx curl zlib openssl ];
   
   meta = {
-    description = "
-      rtorrent is a ncurses client for libtorrent and is ideal for use with screen or dtach.
-    ";
+    description = "An ncurses client for libtorrent, ideal for use with screen or dtach";
   };
 })
diff --git a/pkgs/tools/networking/smbfs-fuse/0.8.7.nix b/pkgs/tools/networking/smbfs-fuse/0.8.7.nix
index c5ef3ebeae0e..be25331460a0 100644
--- a/pkgs/tools/networking/smbfs-fuse/0.8.7.nix
+++ b/pkgs/tools/networking/smbfs-fuse/0.8.7.nix
@@ -21,10 +21,8 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs 
 			[doConfigure doMakeInstall postInstall doForceShare doPropagate]);
-	meta = {
-		description = "
-		Samba mounted via FUSE.
-";
-	  inherit src;
-	};
+  meta = {
+   description = "Samba mounted via FUSE";
+   inherit src;
+  };
 }
diff --git a/pkgs/tools/networking/stunnel/default.nix b/pkgs/tools/networking/stunnel/default.nix
new file mode 100644
index 000000000000..fa225877b403
--- /dev/null
+++ b/pkgs/tools/networking/stunnel/default.nix
@@ -0,0 +1,18 @@
+{ stdenv, fetchurl, openssl }:
+
+stdenv.mkDerivation {
+  name = "stunnel-4.26";
+  
+  src = fetchurl {
+    url = http://www.stunnel.org/download/stunnel/src/stunnel-4.26.tar.gz;
+    sha256 = "1lvbd25krcz1sqk5pj2fv3r32h0160qdxrbzlqqs0kz8f987krp9";
+  };
+
+  buildInputs = [openssl];
+  
+  meta = {
+    description = "Stunnel - Universal SSL wrapper";
+    homepage = http://www.stunnel.org/;
+    license = "GPLv2";
+  };
+}
diff --git a/pkgs/tools/package-management/dpkg/default.nix b/pkgs/tools/package-management/dpkg/default.nix
index 1e6a809a8e98..2d8adc1350a1 100644
--- a/pkgs/tools/package-management/dpkg/default.nix
+++ b/pkgs/tools/package-management/dpkg/default.nix
@@ -1,11 +1,11 @@
 {stdenv, fetchurl, perl, zlib, bzip2}:
 
 stdenv.mkDerivation {
-  name = "dpkg-1.14.22";
+  name = "dpkg-1.14.25";
   
   src = fetchurl {
-    url = mirror://debian/pool/main/d/dpkg/dpkg_1.14.22.tar.gz;
-    sha256 = "10ak9p7ylmfc76hfjqhzyblh2cgc5g4s8ljbxzya1yszsvb59sgq";
+    url = mirror://debian/pool/main/d/dpkg/dpkg_1.14.25.tar.gz;
+    sha256 = "1111r1ijyh149h7vby9vc8137hl9778ja3dln7ilkxhc1y1yjp2l";
   };
 
   configureFlags = "--without-dselect --with-admindir=/var/lib/dpkg";
diff --git a/pkgs/tools/package-management/nix/unstable.nix b/pkgs/tools/package-management/nix/unstable.nix
index c613f2f63f9c..3ce33f6f6be0 100644
--- a/pkgs/tools/package-management/nix/unstable.nix
+++ b/pkgs/tools/package-management/nix/unstable.nix
@@ -5,11 +5,11 @@
 }:
 
 stdenv.mkDerivation {
-  name = "nix-0.13pre13641";
+  name = "nix-0.13pre14422";
   
   src = fetchurl {
-    url = http://hydra.nixos.org/download/546/1/nix-0.13pre13641.tar.bz2;
-    sha256 = "83936327ed7cfa6e6a103764c3f43c780b2727ed804721200811ba999c31c7e1";
+    url = http://hydra.nixos.org/build/2775/download/1/nix-0.13pre14422.tar.bz2;
+    sha256 = "29362caa3fece6eae9d06a14930bf04fba41801b79a0f43eefb2ecc719fab934";
   };
 
   buildInputs = [perl curl openssl];
@@ -23,6 +23,8 @@ stdenv.mkDerivation {
 
   doCheck = true;
 
+  passthru = { inherit aterm; };
+
   meta = {
     description = "The Nix Deployment System";
     homepage = http://nixos.org/;
diff --git a/pkgs/tools/security/gnupg2/default.nix b/pkgs/tools/security/gnupg2/default.nix
index 19fa84ae6500..9bab4b5c7877 100644
--- a/pkgs/tools/security/gnupg2/default.nix
+++ b/pkgs/tools/security/gnupg2/default.nix
@@ -5,11 +5,11 @@
 , pth, libgcrypt, libassuan, libksba, libusb, curl }:
 
 stdenv.mkDerivation rec {
-  name = "gnupg-2.0.10";
+  name = "gnupg-2.0.11";
 
   src = fetchurl {
     url = "mirror://gnupg/gnupg/${name}.tar.bz2";
-    sha256 = "08yz2kgcnphjml5mhq4bm4dg64jrz79p97nlrlb88ym6p6ybg26l";
+    sha256 = "0z5lm0zz8l8yn61jbbyy0frrbhsjyvmq8pxwhgjsgx3isj518h4c";
   };
 
   buildInputs = [ readline openldap bzip2 zlib libgpgerror pth libgcrypt
@@ -33,5 +33,7 @@ stdenv.mkDerivation rec {
     '';
 
     homepage = http://gnupg.org/;
+
+    license = "GPLv3+";
   };
 }
diff --git a/pkgs/tools/security/seccure/0.3.nix b/pkgs/tools/security/seccure/0.3.nix
index 1725d7ab903a..b9a8d42541e7 100644
--- a/pkgs/tools/security/seccure/0.3.nix
+++ b/pkgs/tools/security/seccure/0.3.nix
@@ -20,9 +20,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			["doPatch" doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		Elliptic Curve Cryptography. Zero-configuration.
-";
+		description = "Zero-configuration elliptic curve cryptography utility";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/security/ssss/0.5.nix b/pkgs/tools/security/ssss/0.5.nix
index 28c591850699..a6e8429a9df0 100644
--- a/pkgs/tools/security/ssss/0.5.nix
+++ b/pkgs/tools/security/ssss/0.5.nix
@@ -23,9 +23,7 @@ stdenv.mkDerivation rec {
 		(textClosure localDefs 
 			["doPatch" doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-		Shamir Secret Sharing Scheme
-";
+		description = "Shamir Secret Sharing Scheme";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/security/sudo/default.nix b/pkgs/tools/security/sudo/default.nix
index 61726cf31751..be5933ea45e0 100644
--- a/pkgs/tools/security/sudo/default.nix
+++ b/pkgs/tools/security/sudo/default.nix
@@ -1,11 +1,11 @@
 {stdenv, fetchurl, coreutils, pam}:
 
 stdenv.mkDerivation rec {
-  name = "sudo-1.6.9p17";
+  name = "sudo-1.7.0";
 
   src = fetchurl {
-    url = "http://www.sudo.ws/sudo/dist/${name}.tar.gz";
-    sha256 = "15j5qzwn1nl9fr6ss3b2fk803cin3w11081rgqmm8vscd3zx8b0y";
+    url = "ftp://ftp.sudo.ws/pub/sudo/${name}.tar.gz";
+    sha256 = "0y0r74vvcn1q4c220ha0azs8d4kyjr3x3bl6ilxqp77khx1fjzaz";
   };
 
   # `--with-stow' allows /etc/sudoers to be a symlink.  Only it
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
 
   postConfigure = "
     sed -e '/_PATH_MV/d; /_PATH_VI/d' -i config.h
+    echo '#define _PATH_SUDO_LOGFILE \"/var/log/sudo.log\"' >> config.h
+    echo '#define _PATH_SUDO_TIMEDIR \"/var/run/sudo\"' >> config.h
     echo '#define _PATH_MV \"/var/run/current-system/sw/bin/mv\"' >> config.h
     echo '#define _PATH_VI \"/var/run/current-system/sw/bin/nano\"' >> config.h
     echo '#define EDITOR _PATH_VI' >>config.h
diff --git a/pkgs/tools/system/at/default.nix b/pkgs/tools/system/at/default.nix
index 21b35ad9b956..3acc5fd877dd 100644
--- a/pkgs/tools/system/at/default.nix
+++ b/pkgs/tools/system/at/default.nix
@@ -5,8 +5,8 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     # Debian is apparently the last location where it can be found.
-    url = mirror://debian/pool/main/a/at/at_3.1.10.1.tar.gz;
-    sha256 = "188j6v0hq9avd9v7mhc8gdyg4wycc7lqviw4idwn0jjvwkky5428";
+    url = mirror://debian/pool/main/a/at/at_3.1.10.2.tar.gz;
+    sha256 = "03v96zil1xs15px26xmhxsfn7wx84a3zwpnwmp69hn5s911api1m";
   };
 
   patches = [ ./install.patch ];
@@ -28,4 +28,4 @@ stdenv.mkDerivation {
     license = "GPLv2+";
     homepage = http://packages.qa.debian.org/at;
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/tools/system/filelight/default.nix b/pkgs/tools/system/filelight/default.nix
index 901f41f5ac33..872c56f700ea 100644
--- a/pkgs/tools/system/filelight/default.nix
+++ b/pkgs/tools/system/filelight/default.nix
@@ -1,5 +1,5 @@
-{stdenv, fetchurl, kdelibs, qt, x11, zlib, perl,
-	libpng}:
+{stdenv, fetchurl, kdelibs, qt, x11, zlib, perl, libpng}:
+
 stdenv.mkDerivation {
   name = "filelight-1.0";
 
@@ -9,14 +9,15 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [kdelibs qt x11 zlib perl libpng];
-  configureFlags = " --without-debug --without-arts ";
-  preConfigure = "sed -e '/sys_lib_\(dl\)\{0,1\}search_path_spec=/d' -i configure;
-	sed -e '/X_LDFLAGS=/d' -i configure";
+  
+  configureFlags = "--without-debug --without-arts";
+  
+  preConfigure = ''
+    sed -e '/sys_lib_\(dl\)\{0,1\}search_path_spec=/d' -i configure
+    sed -e '/X_LDFLAGS=/d' -i configure
+  '';
 
   meta = {
-    description = "
-	Filelight lets you analyze which directories 
-	and files eat your disk space.
-";
+    description = "A tool for analysing which directories and files eat your disk space";
   };
 }
diff --git a/pkgs/tools/system/gdmap/0.7.5.nix b/pkgs/tools/system/gdmap/0.7.5.nix
index 7f686cb10e6d..ef07df5bf8d5 100644
--- a/pkgs/tools/system/gdmap/0.7.5.nix
+++ b/pkgs/tools/system/gdmap/0.7.5.nix
@@ -15,9 +15,7 @@ stdenv.mkDerivation rec {
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	Recursive rectangle map of disk usage.	
-";
+		description = "Recursive rectangle map of disk usage";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/system/gdmap/0.8.1.nix b/pkgs/tools/system/gdmap/0.8.1.nix
index ee2bd707fff7..982d5651f652 100644
--- a/pkgs/tools/system/gdmap/0.8.1.nix
+++ b/pkgs/tools/system/gdmap/0.8.1.nix
@@ -11,13 +11,11 @@ args : with args;
 	};
 	in with localDefs;
 stdenv.mkDerivation rec {
-	name = "gdmap"+version;
+	name = "gdmap-"+version;
 	builder = writeScript (name + "-builder")
 		(textClosure localDefs [doConfigure doMakeInstall doForceShare doPropagate]);
 	meta = {
-		description = "
-	Recursive rectangle map of disk usage.	
-";
+		description = "Recursive rectangle map of disk usage";
 		inherit src;
 	};
 }
diff --git a/pkgs/tools/system/pciutils/builder.sh b/pkgs/tools/system/pciutils/builder.sh
deleted file mode 100644
index 4cf93bef868f..000000000000
--- a/pkgs/tools/system/pciutils/builder.sh
+++ /dev/null
@@ -1,10 +0,0 @@
-source $stdenv/setup
-
-preBuild=preBuild
-preBuild() {
-  bunzip2 < $pciids > pci.ids
-}
-
-makeFlags="PREFIX=$out $makeFlags"
-
-genericBuild
diff --git a/pkgs/tools/system/pciutils/default.nix b/pkgs/tools/system/pciutils/default.nix
index 92ebcbdad06a..d9ef0474c498 100644
--- a/pkgs/tools/system/pciutils/default.nix
+++ b/pkgs/tools/system/pciutils/default.nix
@@ -1,24 +1,27 @@
 {stdenv, fetchurl, zlib}:
 
 stdenv.mkDerivation {
-  name = "pciutils-3.0.0";
-  
-  builder = ./builder.sh;
+  name = "pciutils-3.1.2";
   
   src = fetchurl {
-    url = mirror://kernel/software/utils/pciutils/pciutils-3.0.0.tar.bz2;
-    sha256 = "1q9j7w95ysy6c02j7p3z58y23n5v2cdjwy6hz8s9xzvnlr0ynpnh";
+    url = mirror://kernel/software/utils/pciutils/pciutils-3.1.2.tar.bz2;
+    sha256 = "15wksvqcgdj0hvsp5irc1igiqid69rrzpc33qj9nlyssvyw40vpn";
   };
   
   buildInputs = [zlib];
 
   pciids = fetchurl {
-    url = http://nixos.org/tarballs/pci.ids.20080830.bz2;
-    sha256 = "0nfjj9lsifmm6js9w0isrscirr1a7dj9ynppbc0g5i19rzrmwafy";
+    # Obtained from http://pciids.sourceforge.net/v2.2/pci.ids.bz2.
+    url = http://nixos.org/tarballs/pci.ids.20090220.bz2;
+    sha256 = "1zdp85vcxhgrw1rwcsa35pk4j1b3scb7i61gzghbcn2mrm9cwwd9";
   };
 
   # Override broken auto-detect logic.
-  makeFlags = "ZLIB=yes DNS=yes";
+  makeFlags = "ZLIB=yes DNS=yes SHARED=yes PREFIX=\${out}";
+
+  preBuild = ''
+    bunzip2 < $pciids > pci.ids
+  '';
 
   installTargets = "install install-lib";
 
diff --git a/pkgs/tools/system/ts/default.nix b/pkgs/tools/system/ts/default.nix
index 2a09167b9ce0..185c621f7dd5 100644
--- a/pkgs/tools/system/ts/default.nix
+++ b/pkgs/tools/system/ts/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation {
 
-  name = "ts-0.6.2";
+  name = "ts-0.6.4";
 
   installPhase=''make install "PREFIX=$out"'';
 
   src = fetchurl {
-    url = http://vicerveza.homeunix.net/~viric/soft/ts/ts-0.6.2.tar.gz;
-    sha256 = "6a99b48800658fb7424a76c5756a638a6b6abb2a8a8c129e196bc24a9aeeb5cc";
+    url = http://vicerveza.homeunix.net/~viric/soft/ts/ts-0.6.4.tar.gz;
+    sha256 = "caf3e912c150dacc4a182e919ed3eabc1294c5e4e1de333e85d06eea2c0136e3";
   };
 
   meta = { homepage = "http://vicerveza.homeunix.net/~viric/soft/ts";
diff --git a/pkgs/tools/typesetting/asciidoc/default.nix b/pkgs/tools/typesetting/asciidoc/default.nix
index ab6c9aef0aef..8ab1ba98e430 100644
--- a/pkgs/tools/typesetting/asciidoc/default.nix
+++ b/pkgs/tools/typesetting/asciidoc/default.nix
@@ -44,9 +44,10 @@ stdenv.mkDerivation rec {
   '';
 
   meta = {
-    description = ''AsciiDoc is a text-based document generation system.
-                    AsciiDoc input files can be translated to HTML and
-		    DocBook markups'';
+    longDescription = ''
+      AsciiDoc is a text-based document generation system.  AsciiDoc
+      input files can be translated to HTML and DocBook markups.
+    '';
     homepage = http://www.methods.co.nz/asciidoc/;
     license = "GPLv2+";
   };
diff --git a/pkgs/tools/typesetting/docbook2x/default.nix b/pkgs/tools/typesetting/docbook2x/default.nix
index a6e56f1c53bb..30276fcb6f66 100644
--- a/pkgs/tools/typesetting/docbook2x/default.nix
+++ b/pkgs/tools/typesetting/docbook2x/default.nix
@@ -44,9 +44,11 @@ stdenv.mkDerivation rec {
   '';
 
   meta = {
-    description = ''docbook2X is a software package that converts DocBook
-                    documents into the traditional Unix man page format
-		    and the GNU Texinfo format.'';
+    longDescription = ''
+      docbook2X is a software package that converts DocBook documents
+      into the traditional Unix man page format and the GNU Texinfo
+      format.
+    '';
     license = "MIT-style";
     homepage = http://docbook2x.sourceforge.net/;
   };
diff --git a/pkgs/tools/typesetting/rubber/default.nix b/pkgs/tools/typesetting/rubber/default.nix
new file mode 100644
index 000000000000..054632533a11
--- /dev/null
+++ b/pkgs/tools/typesetting/rubber/default.nix
@@ -0,0 +1,32 @@
+{ fetchurl, stdenv, python, texinfo }:
+
+stdenv.mkDerivation rec {
+  name = "rubber-1.1";
+
+  src = fetchurl {
+    url = "http://ebeffara.free.fr/pub/${name}.tar.gz";
+    sha256 = "1xbkv8ll889933gyi2a5hj7hhh216k04gn8fwz5lfv5iz8s34gbq";
+  };
+
+  buildInputs = [ python texinfo ];
+
+  patchPhase = "substituteInPlace configure --replace which \"type -P\"";
+
+  meta = {
+    description = "Rubber, a wrapper for LaTeX and friends";
+
+    longDescription = ''
+      Rubber is a program whose purpose is to handle all tasks related
+      to the compilation of LaTeX documents.  This includes compiling
+      the document itself, of course, enough times so that all
+      references are defined, and running BibTeX to manage
+      bibliographic references.  Automatic execution of dvips to
+      produce PostScript documents is also included, as well as usage
+      of pdfLaTeX to produce PDF documents.
+    '';
+
+    license = "GPLv2+";
+
+    homepage = http://www.pps.jussieu.fr/~beffara/soft/rubber/;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7485424728ec..1794517af381 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -34,7 +34,7 @@
 
 let
 
-  lib = import ../lib;
+  lib = import ../lib; # see also libTests below
 
   # The contents of the configuration file found at $NIXPKGS_CONFIG or
   # $HOME/.nixpkgs/config.nix.
@@ -193,7 +193,8 @@ let
       import (dir + "/${pVersion}.nix") (args // { version = pVersion; });
 
   makeOverridable = f: origArgs: f origArgs //
-    { function = newArgsFun: makeOverridable f (origArgs // (newArgsFun origArgs));
+    { override = newArgs:
+        makeOverridable f (origArgs // (if builtins.isFunction newArgs then newArgs origArgs else newArgs));
     };
 
 
@@ -497,6 +498,10 @@ let
     inherit fetchurl stdenv cmake libcap zlib bzip2;
   };
 
+  cedet = import ../applications/editors/emacs-modes/cedet {
+    inherit fetchurl stdenv emacs;
+  };
+
   checkinstall = import ../tools/package-management/checkinstall {
     inherit fetchurl stdenv gettext;
   };
@@ -560,6 +565,11 @@ let
 
   ddrescue = builderDefsPackage (selectVersion ../tools/system/ddrescue "1.8") {};
 
+  desktop_file_utils = import ../tools/misc/desktop-file-utils {
+    inherit stdenv fetchurl pkgconfig;
+    inherit (gtkLibs) glib;
+  };
+
   dev86 = import ../development/compilers/dev86 {
     inherit fetchurl stdenv;
   };
@@ -959,6 +969,10 @@ let
     inherit fetchurl stdenv;
   };
 
+  netpbm = import ../tools/graphics/netpbm {
+    inherit stdenv fetchsvn libjpeg libpng zlib flex perl libxml2;
+  };
+
   netselect = import ../tools/networking/netselect {
     inherit fetchurl stdenv;
   };
@@ -979,6 +993,10 @@ let
     inherit fetchurl stdenv avahi;
   };
 
+  nylon = import ../tools/networking/nylon {
+    inherit fetchurl stdenv libevent;
+  };
+
   openssh = import ../tools/networking/openssh {
     inherit fetchurl stdenv zlib openssl pam perl;
     pamSupport = getPkgConfig "openssh" "pam" true;
@@ -1047,13 +1065,8 @@ let
     inherit stdenv fetchurl;
   };
 
-  pystringtemplate = import ../tools/text/py-string-template {
-    inherit stdenv fetchurl python;
-    /* TODO: Some parts of this package depend on the ANTLR run-time library
-     *       for Python. We have a package for ANTLR3, too, but that one is
-     *       rather big and contains much more than we need. I guess this issue
-     *       calls for some clever refactoring.
-     */
+  pystringtemplate = import ../development/python-modules/stringtemplate {
+    inherit stdenv fetchurl python antlr;
   };
 
   qtparted = import ../tools/misc/qtparted {
@@ -1067,6 +1080,10 @@ let
     inherit (gnome) gnomevfs GConf;
   };
 
+  remind = import ../tools/misc/remind {
+    inherit fetchurl stdenv;
+  };
+
   replace = import ../tools/text/replace {
     inherit fetchurl stdenv;
   };
@@ -1102,6 +1119,10 @@ let
     inherit fetchurl stdenv libtorrent ncurses pkgconfig libsigcxx curl zlib openssl;
   };
 
+  rubber = import ../tools/typesetting/rubber {
+    inherit fetchurl stdenv python texinfo;
+  };
+
   rxp = import ../tools/text/xml/rxp {
     inherit fetchurl stdenv;
   };
@@ -1177,10 +1198,18 @@ let
     inherit builderDefs gmp;
   };
 
+  stunnel = import ../tools/networking/stunnel {
+    inherit fetchurl stdenv openssl;
+  };
+
   su = import ../tools/misc/su {
     inherit fetchurl stdenv pam;
   };
 
+  system_config_printer = import ../tools/misc/system-config-printer {
+    inherit stdenv fetchurl perl perlXMLParser autoconf automake intltool gettext desktop_file_utils;
+  };
+
   tcpdump = import ../tools/networking/tcpdump {
     inherit fetchurl stdenv libpcap;
   };
@@ -1315,6 +1344,10 @@ let
     inherit fetchurl stdenv;
   };
 
+  zile = import ../applications/editors/zile {
+    inherit fetchurl stdenv ncurses help2man;
+  };
+
   zip = import ../tools/archivers/zip {
     inherit fetchurl stdenv;
   };
@@ -1711,6 +1744,10 @@ let
     };
   */
 
+  gprolog = import ../development/compilers/gprolog {
+    inherit fetchurl stdenv;
+  };
+
   gwt = import ../development/compilers/gwt {
     inherit stdenv fetchurl;
     inherit (gtkLibs) glib gtk pango atk;
@@ -2130,6 +2167,15 @@ let
 
   ### DEVELOPMENT / MISC
 
+  avrgcclibc = import ../development/misc/avr-gcc-with-avr-libc {
+    inherit fetchurl stdenv writeTextFile gnumake coreutils gnutar bzip2
+      gnugrep gnused gawk;
+    inherit gcc;
+  };
+
+  avr8burnomat = import ../development/misc/avr8-burn-omat {
+    inherit fetchurl stdenv unzip;
+  };
 
   /*
   toolbus = import ../development/interpreters/toolbus {
@@ -2166,7 +2212,7 @@ let
   };
 
   antlr = import ../development/tools/parsing/antlr/antlr-2.7.6.nix {
-    inherit fetchurl stdenv jre;
+    inherit fetchurl stdenv jdk python;
   };
 
   antlr3 = import ../development/tools/parsing/antlr {
@@ -2254,6 +2300,10 @@ let
     inherit fetchurl stdenv replace ncurses;
   };
 
+  cmakeUnstable = lowPrio (import ../development/tools/build-managers/cmake/2.6.3.nix {
+    inherit fetchurl stdenv replace ncurses;
+  });
+
   cproto = import ../development/tools/misc/cproto {
     inherit fetchurl stdenv flex bison;
   };
@@ -2278,7 +2328,7 @@ let
   doxygen = import ../development/tools/documentation/doxygen {
     inherit fetchurl stdenv graphviz perl flex bison gnumake;
     inherit (xlibs) libX11 libXext;
-    qt = if getPkgConfig "doxygen" "qt3" true then qt3 else null;
+    qt = if getPkgConfig "doxygen" "qt4" true then qt4 else null;
   };
 
   elfutils = import ../development/tools/misc/elfutils {
@@ -2484,6 +2534,10 @@ let
     stdenv = overrideInStdenv stdenv [gnumake380];
   };
 
+  sloccount = import ../development/tools/misc/sloccount {
+    inherit fetchurl stdenv perl;
+  };
+
   sparse = import ../development/tools/analysis/sparse {
     inherit fetchurl stdenv pkgconfig;
   };
@@ -2692,6 +2746,12 @@ let
     inherit fetchurl stdenv;
   };
 
+  ConsoleKit = import ../development/libraries/ConsoleKit {
+    inherit stdenv fetchurl pkgconfig dbus_glib zlib;
+    inherit (gtkLibs) glib;
+    inherit (xlibs) libX11;
+  };
+  
   coredumper = import ../development/libraries/coredumper {
     inherit fetchurl stdenv;
   };
@@ -2762,6 +2822,13 @@ let
     inherit fetchurl stdenv;
   };
 
+  extremetuxracer = builderDefsPackage (import ../games/extremetuxracer) {
+    inherit mesa tcl freeglut SDL SDL_mixer pkgconfig
+    	libpng gettext intltool;
+    inherit (xlibs) libX11 xproto libXi inputproto
+    	libXmu libXext xextproto libXt libSM libICE;
+  };
+
   eventlog = import ../development/libraries/eventlog {
     inherit fetchurl stdenv;
   };
@@ -2777,7 +2844,7 @@ let
   };
 
   faad2 = import ../development/libraries/faad2 {
-    inherit fetchurl stdenv autoconf automake libtool;
+    inherit fetchurl stdenv;
   };
 
   fcgi = import ../development/libraries/fcgi {
@@ -2785,17 +2852,14 @@ let
   };
 
   ffmpeg = import ../development/libraries/ffmpeg {
-    inherit fetchurl stdenv;
-  };
-
-  ffmpeg_svn = import ../development/libraries/ffmpeg_svn_snapshot {
-    inherit fetchurl stdenv;
+    inherit fetchurl stdenv faad2;
   };
 
   fftw = import ../development/libraries/fftw {
     inherit fetchurl stdenv builderDefs stringsWithDeps;
     singlePrecision = false;
   };
+
   fftwSinglePrec = import ../development/libraries/fftw {
     inherit fetchurl stdenv builderDefs stringsWithDeps;
     singlePrecision = true;
@@ -2808,6 +2872,10 @@ let
     flags = [ "useNixLibs" "threads" "shared" "gl" ];
   };
 
+  fmod = import ../development/libraries/fmod {
+    inherit stdenv fetchurl;
+  };
+
   freeimage = import ../development/libraries/freeimage {
     inherit fetchurl stdenv unzip;
   };
@@ -3204,7 +3272,7 @@ let
   };
 
   libdvdnav = import ../development/libraries/libdvdnav {
-    inherit fetchurl stdenv;
+    inherit fetchurl stdenv libdvdread;
   };
 
   libdvdread = import ../development/libraries/libdvdread {
@@ -3219,8 +3287,7 @@ let
     inherit fetchurl stdenv gettext;
   };
 
-  libextractor = composedArgsAndFun (selectVersion ../development/libraries/libextractor "0.5.18")
-  {
+  libextractor = composedArgsAndFun (selectVersion ../development/libraries/libextractor "0.5.18") {
     inherit fetchurl stdenv builderDefs zlib;
   };
 
@@ -3240,6 +3307,10 @@ let
     inherit fetchurl stdenv pkgconfig libusb libtool libexif libjpeg gettext;
   };
 
+  libical = import ../development/libraries/libical {
+    inherit stdenv fetchurl perl;
+  };
+
   libQGLViewer = import ../development/libraries/libqglviewer {
     inherit fetchurl stdenv;
     inherit qt4;
@@ -3308,6 +3379,10 @@ let
     inherit fetchurl stdenv;
   };
 
+  libmsn = import ../development/libraries/libmsn {
+    inherit stdenv fetchurl cmake openssl;
+  };
+
   libmspack = import ../development/libraries/libmspack {
     inherit fetchurl stdenv;
   };
@@ -3472,8 +3547,7 @@ let
   mediastreamer = composedArgsAndFun (selectVersion
       ../development/libraries/mediastreamer "2.2.0-cvs20080207") {
     inherit fetchurl stdenv automake libtool autoconf alsaLib pkgconfig speex
-      ortp;
-    ffmpeg = ffmpeg_svn;
+      ortp ffmpeg;
   };
 
   mesaSupported =
@@ -3608,6 +3682,13 @@ let
     qt4Support = getConfig [ "poppler" "qt4Support" ] false;
   };
 
+  popplerQt4 = import ../development/libraries/poppler {
+    inherit fetchurl stdenv qt4 cairo freetype fontconfig zlib libjpeg
+      pkgconfig;
+    inherit (gtkLibs) glib gtk;
+    qt4Support = true;
+  };
+
   popt = import ../development/libraries/popt {
     inherit fetchurl stdenv gettext;
   };
@@ -3743,8 +3824,7 @@ let
   };
 
   tapioca_qt = import ../development/libraries/tapioca-qt {
-    inherit fetchsvn stdenv cmake telepathy_qt;
-    qt = qt4;
+    inherit stdenv fetchurl cmake qt4 telepathy_qt;
   };
 
   tecla = import ../development/libraries/tecla {
@@ -3761,8 +3841,7 @@ let
   };
 
   telepathy_qt = import ../development/libraries/telepathy-qt {
-    inherit fetchsvn stdenv cmake;
-    qt = qt4;
+    inherit stdenv fetchurl cmake qt4;
   };
 
   tk = composedArgsAndFun (selectVersion ../development/libraries/tk "8.4.18") {
@@ -4192,15 +4271,26 @@ let
     propagatedBuildInputs = [perlTestException];
   };
 
-  perlCatalystActionRenderView = buildPerlPackage {
-    name = "Catalyst-Action-RenderView-0.08";
+  perlCatalystActionRenderView = buildPerlPackage rec {
+    name = "Catalyst-Action-RenderView-0.09";
     src = fetchurl {
-      url = mirror://cpan/authors/id/M/MR/MRAMBERG/Catalyst-Action-RenderView-0.08.tar.gz;
-      sha256 = "1qng995mzgpm1gwb315ynm3spajf0ypmh1ciivqks3r0aamq2ar0";
+      url = "mirror://cpan/authors/id/M/MR/MRAMBERG/${name}.tar.gz";
+      sha256 = "06bxbdfjgnwp8zz4mqq2x7n5ng02h94m27l610icsps7r9iwi8f9";
     };
     propagatedBuildInputs = [perlCatalystRuntime perlHTTPRequestAsCGI perlDataVisitor];
   };
 
+  perlCatalystAuthenticationStoreDBIxClass = buildPerlPackage rec {
+    name = "Catalyst-Authentication-Store-DBIx-Class-0.1082";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/J/JA/JAYK/${name}.tar.gz";
+      sha256 = "1rh5jwqw3fb16ll5id8z0igpqdwr0czi0xbaa2igalxr53hh2cni";
+    };
+    propagatedBuildInputs = [
+      perlCatalystRuntime perlCatalystPluginAuthentication perlCatalystModelDBICSchema
+    ];
+  };
+
   perlCatalystComponentInstancePerContext = buildPerlPackage rec {
     name = "Catalyst-Component-InstancePerContext-0.001001";
     src = fetchurl {
@@ -4239,6 +4329,24 @@ let
     ];
   };
 
+  perlCatalystEngineHTTPPrefork = buildPerlPackage rec {
+    name = "Catalyst-Engine-HTTP-Prefork-0.50";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/A/AG/AGRUNDMA/${name}.tar.gz";
+      sha256 = "1p8mnxqaxd6sxyy9q4f0h5gy4mcnvb3y93y49ziq6kmcvy6yw2p7";
+    };
+    propagatedBuildInputs = [
+      perlCatalystRuntime perlHTTPBody perlNetServer
+      perlCookieXS perlHTTPHeaderParserXS
+    ];
+    buildInputs = [perlTestPod perlTestPodCoverage];
+    patches = [
+      # Fix chunked transfers (they were missing the final CR/LF at
+      # the end, which makes curl barf).
+      ../development/perl-modules/catalyst-fix-chunked-encoding.patch
+    ];
+  };
+
   perlCatalystManual = buildPerlPackage rec {
     name = "Catalyst-Manual-5.7016";
     src = fetchurl {
@@ -4262,15 +4370,18 @@ let
   };
 
   perlCatalystRuntime = buildPerlPackage rec{
-    name = "Catalyst-Runtime-5.71000";
+    name = "Catalyst-Runtime-5.8000_06";
     src = fetchurl {
       url = "mirror://cpan/authors/id/M/MR/MRAMBERG/${name}.tar.gz";
-      sha256 = "0j9kwp2ylah0qsvgv08lnv49dlykx94bivwngw3zwn3g9qfbq26c";
+      sha256 = "181fynr72q73xs78rk2hmlgqhx2n35ysv73rfd69780na1j3gkzf";
     };
     propagatedBuildInputs = [
       perlLWP perlClassAccessor perlClassDataInheritable perlClassInspector
       perlCGISimple perlDataDump perlFileModified perlHTTPBody perlHTTPRequestAsCGI
       perlPathClass perlTextSimpleTable perlTreeSimple perlTreeSimpleVisitorFactory
+      perlSubExporter perlMROCompat perlTestMockObject perlClassMOP perlMoose
+      perlNamespaceClean perlScopeUpper perlMooseXEmulateClassAccessorFast
+      perlClassC3 perlClassC3AdoptNEXT
     ];
   };
 
@@ -4296,17 +4407,6 @@ let
     ];
   };
 
-  perlCatalystPluginAuthenticationStoreDBIxClass = buildPerlPackage {
-    name = "Catalyst-Authentication-Store-DBIx-Class-0.107";
-    src = fetchurl {
-      url = http://search.cpan.org/CPAN/authors/id/J/JA/JAYK/Catalyst-Authentication-Store-DBIx-Class-0.107.tar.gz;
-      sha256 = "1vlrl65wf2i65zm2svb1mvylcx5vdrvxr09y16az60kdwiqvam6n";
-    };
-    propagatedBuildInputs = [
-      perlCatalystRuntime perlCatalystPluginAuthentication perlCatalystModelDBICSchema
-    ];
-  };
-
   perlCatalystPluginAuthorizationACL = buildPerlPackage {
     name = "Catalyst-Plugin-Authorization-ACL-0.10";
     src = fetchurl {
@@ -4346,7 +4446,7 @@ let
     propagatedBuildInputs = [perlCatalystRuntime perlHTMLWidget];
   };
 
-  perlCatalystPluginSession = buildPerlPackage rec{
+  perlCatalystPluginSession = buildPerlPackage rec {
     name = "Catalyst-Plugin-Session-0.20";
     src = fetchurl {
       url = "mirror://cpan/authors/id/B/BO/BOBTFISH/${name}.tar.gz";
@@ -4398,11 +4498,23 @@ let
     propagatedBuildInputs = [perlCatalystRuntime perlMIMETypes];
   };
 
-  perlCatalystViewTT = buildPerlPackage {
-    name = "Catalyst-View-TT-0.27";
+  perlCatalystViewDownload = buildPerlPackage rec {
+    name = "Catalyst-View-Download-0.04";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/G/GA/GAUDEON/${name}.tar.gz";
+      sha256 = "1d5ck28db6vbks7cwkj1qh0glhxskl3vymksv3izfzbk6xnjrabi";
+    };
+    propagatedBuildInputs = [
+      perlCatalystRuntime perlTestWWWMechanizeCatalyst perlTestUseOk
+      perlTextCSV
+    ];
+  };
+
+  perlCatalystViewTT = buildPerlPackage rec {
+    name = "Catalyst-View-TT-0.28";
     src = fetchurl {
-      url = mirror://cpan/authors/id/M/MR/MRAMBERG/Catalyst-View-TT-0.27.tar.gz;
-      sha256 = "03xs31y9m5nrmfzpfmlzlg3ivys1gg8nwd6fvwbg72a3z36brghd";
+      url = "mirror://cpan/authors/id/M/MR/MRAMBERG/${name}.tar.gz";
+      sha256 = "18chdzgv0fvq65kfp8am2f5cayxpzg355q7jin4xlzygbgh2a5vg";
     };
     propagatedBuildInputs = [
       perlCatalystRuntime perlTemplateToolkit perlClassAccessor
@@ -4410,6 +4522,14 @@ let
     ];
   };
 
+  perlCGICookieXS = buildPerlPackage rec {
+    name = "CGI-Cookie-XS-0.16";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/A/AG/AGENT/${name}.tar.gz";
+      sha256 = "1jrd3f11sz17117nvssrrf6r80fr412615n5ffspbsap4n816bnn";
+    };
+  };
+
   perlCGISession = buildPerlPackage {
     name = "CGI-Session-3.95";
     src = fetchurl {
@@ -4468,6 +4588,15 @@ let
     };
   };
 
+  perlClassC3AdoptNEXT = buildPerlPackage rec {
+    name = "Class-C3-Adopt-NEXT-0.07";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/F/FL/FLORA/${name}.tar.gz";
+      sha256 = "1kxbdq10vicrbz3i6hvml3mma5x0r523gfdd649f9bvrsizb0jxj";
+    };
+    propagatedBuildInputs = [perlMROCompat perlTestException perlListMoreUtils];
+  };
+
   perlClassC3Componentised = buildPerlPackage {
     name = "Class-C3-Componentised-1.0003";
     src = fetchurl {
@@ -4546,6 +4675,10 @@ let
     propagatedBuildInputs = [perlClassInspector];
   };
 
+  perlCompressRawBzip2 = import ../development/perl-modules/Compress-Raw-Bzip2 {
+    inherit fetchurl buildPerlPackage bzip2;
+  };
+
   perlCompressRawZlib = import ../development/perl-modules/Compress-Raw-Zlib {
     inherit fetchurl buildPerlPackage zlib;
   };
@@ -4585,6 +4718,17 @@ let
     };
   };
 
+  perlCookieXS = buildPerlPackage rec {
+    name = "Cookie-XS-0.11";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/A/AG/AGENT/${name}.tar.gz";
+      sha256 = "1616rcn2qn1cwiv3rxb8mq5fmwxpj4gya1lxxxq2w952h03p3fd3";
+    };
+    propagatedBuildInputs = [
+      perlTestMore perlCGICookieXS
+    ];
+  };
+
   perlCryptCBC = buildPerlPackage rec {
     name = "Crypt-CBC-2.30";
     src = fetchurl {
@@ -4652,7 +4796,7 @@ let
       sha256 = "10cjh3rrqi4gwrmkpzilzmaqdrh71wr59035s6b4p2dzd117p931";
     };
     propagatedBuildInputs = [
-      perlTestMockObject perlMouse perlTaskWeaken perlTieUseOk perlTieToObject
+      perlTestMockObject perlMouse perlTaskWeaken perlTestUseOk perlTieToObject
       perlNamespaceClean
     ];
   };
@@ -4754,10 +4898,10 @@ let
   };
 
   perlDBIxClass = buildPerlPackage rec {
-    name = "DBIx-Class-0.08011";
+    name = "DBIx-Class-0.08012";
     src = fetchurl {
       url = "mirror://cpan/authors/id/R/RI/RIBASUSHI/${name}.tar.gz";
-      sha256 = "0bdp2hqbxdn0xzjja0wcynwvq36z2vwz7yx5w34s82g59pmf5dbx";
+      sha256 = "02m5bg1zq1w1w2s3vnnjh46spn6d8xzj6b00vmlyfmf9hmrsdsxj";
     };
     propagatedBuildInputs = [
       perlTestNoWarnings perlTestException perlDBI perlScopeGuard
@@ -4767,7 +4911,6 @@ let
       perlModuleFind perlDBDSQLite perlJSONAny perlSubName
     ];
     buildInputs = [perlTestPod perlTestPodCoverage];
-    doCheck = false; /* it says "8 subtests UNEXPECTEDLY SUCCEEDED" */
   };
 
   perlDBIxClassHTMLWidget = buildPerlPackage rec {
@@ -5048,6 +5191,14 @@ let
     propagatedBuildInputs = [perlLWP perlYAML];
   };
 
+  perlHTTPHeaderParserXS = buildPerlPackage rec {
+    name = "HTTP-HeaderParser-XS-0.20";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/M/MA/MARKSMITH/${name}.tar.gz";
+      sha256 = "1vs6sw431nnlnbdy6jii9vqlz30ndlfwdpdgm8a1m6fqngzhzq59";
+    };
+  };
+
   perlHTTPRequestAsCGI = buildPerlPackage {
     name = "HTTP-Request-AsCGI-0.5";
     src = fetchurl {
@@ -5092,6 +5243,15 @@ let
     };
   };
 
+  perlIOCompressBzip2 = buildPerlPackage rec {
+    name = "IO-Compress-Bzip2-2.015";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/P/PM/PMQS/${name}.tar.gz";
+      sha256 = "1kfksf2bslfkviry228p07m1ksnf06mh8gkmdpbrmlmxlbs2idnc";
+    };
+    propagatedBuildInputs = [perlIOCompressBase perlCompressRawBzip2];
+  };
+
   perlIOCompressGzip = buildPerlPackage rec {
     name = "IO-Compress-Zlib-2.015";
     src = fetchurl {
@@ -5268,6 +5428,15 @@ let
     ];
   };
 
+  perlMooseXEmulateClassAccessorFast = buildPerlPackage rec {
+    name = "MooseX-Emulate-Class-Accessor-Fast-0.00800";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/G/GR/GRODITI/${name}.tar.gz";
+      sha256 = "1z2sld2sw1mlwxwzxxanik3086cw14rdsx2wwnzrfy7prsnigcl2";
+    };
+    propagatedBuildInputs = [perlMoose perlNamespaceClean];
+  };
+
   perlMouse = buildPerlPackage {
     name = "Mouse-0.09";
     src = fetchurl {
@@ -5311,6 +5480,15 @@ let
     };
   };
 
+  perlNetServer = buildPerlPackage rec {
+    name = "Net-Server-0.97";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/R/RH/RHANDOM/${name}.tar.gz";
+      sha256 = "13vhv13w06g6h6iqx440q1h6hwj0kpjdxcc3fl9crkwg5glygg2f";
+    };
+    doCheck = false; # seems to hang waiting for connections
+  };
+
   perlObjectSignature = buildPerlPackage {
     name = "Object-Signature-1.05";
     src = fetchurl {
@@ -5470,6 +5648,14 @@ let
     };
   };
 
+  perlScopeUpper = buildPerlPackage rec {
+    name = "Scope-Upper-0.06";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/V/VP/VPIT/${name}.tar.gz";
+      sha256 = "1qaf310wbfpjb0lmg3fpmhbfnjxqw3j47rj0w0f0cy4bgihi8l43";
+    };
+  };
+
   perlSetObject = buildPerlPackage {
     name = "Set-Object-1.26";
     src = fetchurl {
@@ -5478,12 +5664,15 @@ let
     };
   };
 
-  perlSQLAbstract = buildPerlPackage {
-    name = "SQL-Abstract-1.24";
+  perlSQLAbstract = buildPerlPackage rec {
+    name = "SQL-Abstract-1.50";
     src = fetchurl {
-      url = mirror://cpan/authors/id/M/MS/MSTROUT/SQL-Abstract-1.24.tar.gz;
-      sha256 = "0vnpnca9cahnk0zgzqkngcwyzjqnckar0jwp3vyhj9hcaylirnvg";
+      url = "mirror://cpan/authors/id/M/MS/MSTROUT/${name}.tar.gz";
+      sha256 = "0nyc16ynks4xqa442vycs8wy9xbs0q63wm4iik8ar1axr53lyyqb";
     };
+    propagatedBuildInputs = [
+      perlTestDeep perlTestException perlTestWarn
+    ];    
   };
 
   perlSQLAbstractLimit = buildPerlPackage rec {
@@ -5584,16 +5773,16 @@ let
   };
 
   perlTaskCatalystTutorial = buildPerlPackage rec {
-    name = "Task-Catalyst-Tutorial-0.05";
+    name = "Task-Catalyst-Tutorial-0.06";
     src = fetchurl {
-      url = "mirror://cpan/authors/id/M/MS/MSTROUT/${name}.tar.gz";
-      sha256 = "0mqn64bspz1rq6m62yvy1gvmm0swz8xfhh8rg2p024v7g2qcyiy8";
+      url = "mirror://cpan/authors/id/M/MR/MRAMBERG/${name}.tar.gz";
+      sha256 = "07nn8a30n3qylpnf7s4ma6w462g31pywwikib117hr2mc7cv5cbm";
     };
     propagatedBuildInputs = [
       perlCatalystManual perlCatalystRuntime perlCatalystDevel
       perlCatalystPluginSession perlCatalystPluginAuthentication
       perlCatalystPluginAuthenticationStoreDBIC
-      perlCatalystPluginAuthenticationStoreDBIxClass
+      perlCatalystAuthenticationStoreDBIxClass
       perlCatalystPluginAuthorizationRoles
       perlCatalystPluginAuthorizationACL
       perlCatalystPluginHTMLWidget
@@ -5740,6 +5929,14 @@ let
     };
   };
 
+  perlTestUseOk = buildPerlPackage rec {
+    name = "Test-use-ok-0.02";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/A/AU/AUDREYT/${name}.tar.gz";
+      sha256 = "11inaxiavb35k8zwxwbfbp9wcffvfqas7k9idy822grn2sz5gyig";
+    };
+  };
+
   perlTestWarn = buildPerlPackage {
     name = "Test-Warn-0.11";
     src = fetchurl {
@@ -5776,19 +5973,19 @@ let
     doCheck = false;
   };
 
-  perlTextSimpleTable = buildPerlPackage {
-    name = "Text-SimpleTable-0.05";
+  perlTextCSV = buildPerlPackage rec {
+    name = "Text-CSV-1.10";
     src = fetchurl {
-      url = mirror://cpan/authors/id/S/SR/SRI/Text-SimpleTable-0.05.tar.gz;
-      sha256 = "028pdfmr2gnaq8w3iar8kqvrpxcghnag8ls7h4227l9zbxd1k9p9";
+      url = "mirror://cpan/authors/id/M/MA/MAKAMAKA/${name}.tar.gz";
+      sha256 = "0vb0093v3kk7iczb46zzdg7myfyjldwrk8wbk7ibk56gvj350f7c";
     };
   };
 
-  perlTieUseOk = buildPerlPackage {
-    name = "Test-use-ok-0.02";
+  perlTextSimpleTable = buildPerlPackage {
+    name = "Text-SimpleTable-0.05";
     src = fetchurl {
-      url = mirror://cpan/authors/id/A/AU/AUDREYT/Test-use-ok-0.02.tar.gz;
-      sha256 = "11inaxiavb35k8zwxwbfbp9wcffvfqas7k9idy822grn2sz5gyig";
+      url = mirror://cpan/authors/id/S/SR/SRI/Text-SimpleTable-0.05.tar.gz;
+      sha256 = "028pdfmr2gnaq8w3iar8kqvrpxcghnag8ls7h4227l9zbxd1k9p9";
     };
   };
 
@@ -5798,7 +5995,7 @@ let
       url = mirror://cpan/authors/id/N/NU/NUFFIN/Tie-ToObject-0.03.tar.gz;
       sha256 = "1x1smn1kw383xc5h9wajxk9dlx92bgrbf7gk4abga57y6120s6m3";
     };
-    propagatedBuildInputs = [perlTieUseOk];
+    propagatedBuildInputs = [perlTestUseOk];
   };
 
   perlTimeDate = buildPerlPackage {
@@ -5860,12 +6057,19 @@ let
     };
   };
 
-  perlUNIVERSALisa = buildPerlPackage {
-    name = "UNIVERSAL-isa-1.00";
+  perlUNIVERSALisa = stdenv.mkDerivation rec {
+    name = "UNIVERSAL-isa-1.01";
     src = fetchurl {
-      url = mirror://cpan/authors/id/C/CH/CHROMATIC/UNIVERSAL-isa-1.00_00.tar.gz;
-      sha256 = "04dj0z458k57l3phmq635bdmj3zzl2iy5dxp3yqaldc6g65wz0d0";
+      url = "mirror://cpan/authors/id/C/CH/CHROMATIC/${name}.tar.gz";
+      sha256 = "0iksklmfhiaxg2rsw827n97k1mris6dg596rdwk2gmrwl0rsk0wz";
     };
+    # Urgh, this package doesn't have a Makefile.PL.
+    buildInputs = [perl];
+    configurePhase = "perl Build.PL --prefix=$out";
+    buildPhase = "perl ./Build";
+    doCheck = true;
+    checkPhase = "perl ./Build test";
+    installPhase = "perl ./Build install";
   };
 
   perlUNIVERSALrequire = buildPerlPackage {
@@ -6047,6 +6251,10 @@ let
     inherit fetchurl stdenv python gmp;
   };
 
+  pycups = import ../development/python-modules/pycups {
+    inherit stdenv fetchurl python cups;
+  };
+
   pygame = import ../development/python-modules/pygame {
     inherit fetchurl stdenv python pkgconfig SDL SDL_image
       SDL_mixer SDL_ttf numeric;
@@ -6074,6 +6282,14 @@ let
     inherit python;
   };
 
+  rhpl = import ../development/python-modules/rhpl {
+    inherit stdenv fetchurl rpm cpio python wirelesstools gettext;
+  };
+
+  sip = import ../development/python-modules/python-sip {
+    inherit stdenv fetchurl python;
+  };
+
   pyqt = builderDefsPackage (selectVersion ../development/python-modules/pyqt "4.3.3") {
     inherit pkgconfig python pythonSip;
     inherit (xlibs) libX11 libXext;
@@ -6081,6 +6297,10 @@ let
     qt = qt4;
   };
 
+  pyqt4 = import ../development/python-modules/pyqt {
+    inherit stdenv fetchurl python sip qt4;
+  };
+
   pyx = import ../development/python-modules/pyx {
     inherit fetchurl stdenv python makeWrapper;
   };
@@ -6364,6 +6584,10 @@ let
     inherit fetchurl stdenv zlibStatic;
   };
 
+  cryptsetup = import ../os-specific/linux/cryptsetup {
+    inherit stdenv fetchurl e2fsprogs popt devicemapper udev;
+  };
+
   cramfsswap = import ../os-specific/linux/cramfsswap {
     inherit fetchurl stdenv zlib;
   };
@@ -6410,7 +6634,7 @@ let
     inherit fetchurl stdenv;
   };
 
-  gpm = builderDefsPackage (selectVersion ../servers/gpm "1.20.3pre6") {
+  gpm = builderDefsPackage (selectVersion ../servers/gpm "1.20.6") {
     inherit lzma ncurses bison;
     flex = flex2535;
   };
@@ -6899,7 +7123,7 @@ let
     kernelHeaders = kernelHeaders_2_6_26;
   };
 
-  kvm82 = import ../os-specific/linux/kvm/82.nix {
+  kvm84 = import ../os-specific/linux/kvm/84.nix {
     inherit fetchurl stdenv zlib e2fsprogs SDL alsaLib pkgconfig rsync;
     kernelHeaders = kernelHeaders_2_6_28;
   };
@@ -6955,6 +7179,11 @@ let
     inherit fetchurl stdenv;
   };
 
+  neverball = import ../games/neverball {
+    inherit stdenv fetchurl SDL mesa libpng libjpeg SDL_ttf libvorbis
+      gettext;
+  };
+
   numactl = import ../os-specific/linux/numactl {
     inherit fetchurl stdenv;
   };
@@ -7003,7 +7232,7 @@ let
   };
 
   powertop = import ../os-specific/linux/powertop {
-    inherit fetchurl stdenv ncurses;
+    inherit fetchurl stdenv ncurses gettext;
   };
 
   procps = import ../os-specific/linux/procps {
@@ -7085,6 +7314,15 @@ let
     inherit fetchurl stdenv;
   };
 
+  tunctl = import ../os-specific/linux/tunctl {
+    inherit stdenv fetchurl;
+  };
+
+  /*tuxracer = builderDefsPackage (import ../games/tuxracer) {
+    inherit mesa tcl freeglut;
+    inherit (xlibs) libX11 xproto;
+  };*/
+
   udev = import ../os-specific/linux/udev {
     inherit fetchurl stdenv;
   };
@@ -7250,8 +7488,8 @@ let
     inherit fetchurl stdenv unzip;
   };
 
-  shared_mime_info = selectVersion ../data/misc/shared-mime-info "0.23" {
-    inherit fetchurl stdenv perl perlXMLParser pkgconfig gettext libxml2;
+  shared_mime_info = import ../data/misc/shared-mime-info {
+    inherit fetchurl stdenv pkgconfig gettext intltool libxml2;
     inherit (gtkLibs) glib;
   };
 
@@ -7511,9 +7749,10 @@ let
     version = "0.6.2";
   };
 
-  compizBase = composedArgsAndFun (assert mesaSupported; selectVersion ../applications/window-managers/compiz "0.7.8") {
+  compizBase = composedArgsAndFun (assert mesaSupported; selectVersion ../applications/window-managers/compiz "0.8.0") {
     inherit lib builderDefs stringsWithDeps;
-    inherit fetchurl stdenv pkgconfig libpng mesa perl perlXMLParser libxslt gettext;
+    inherit fetchurl stdenv pkgconfig libpng mesa perl perlXMLParser libxslt gettext
+      intltool;
     inherit (xorg) libXcomposite libXfixes libXdamage libXrandr
       libXinerama libICE libSM libXrender xextproto compositeproto fixesproto
       damageproto randrproto xineramaproto renderproto kbproto xproto libX11
@@ -7699,14 +7938,16 @@ let
   };
 
   emacsUnicode = lowPrio (import ../applications/editors/emacs-unicode {
-    inherit fetchurl stdenv ncurses pkgconfig x11 Xaw3d
-      libpng libjpeg libungif libtiff texinfo;
+    inherit fetchcvs stdenv ncurses pkgconfig x11 Xaw3d
+      libpng libjpeg libungif libtiff texinfo dbus
+      autoconf automake;
     inherit (xlibs) libXaw libXpm libXft;
     inherit (gtkLibs) gtk;
     xawSupport = getPkgConfig "emacs" "xawSupport" false;
     xaw3dSupport = getPkgConfig "emacs" "xaw3dSupport" false;
     gtkGUI = getPkgConfig "emacs" "gtkSupport" true;
     xftSupport = getPkgConfig "emacs" "xftSupport" true;
+    dbusSupport = getPkgConfig "emacs" "dbusSupport" true;
   });
 
   emms = import ../applications/editors/emacs-modes/emms {
@@ -8123,7 +8364,7 @@ let
     inherit stdenv fetchurl libao libmad libid3tag zlib;
   };
 
-  MPlayer = lib.composedArgsAndFun (import ../applications/video/MPlayer) {
+  MPlayer = import ../applications/video/MPlayer {
     inherit fetchurl stdenv freetype x11 zlib libtheora libcaca freefont_ttf libdvdnav
       cdparanoia;
     inherit (xlibs) libX11 libXv libXinerama libXrandr;
@@ -8230,6 +8471,7 @@ let
     imagemagick = imagemagickBig;
     inherit (gtkLibs) glib gtk;
   };
+
   pidginlatexSF = builderDefsPackage
     (import ../applications/networking/instant-messengers/pidgin-plugins/pidgin-latex/pidgin-latex-sf.nix)
     {
@@ -8269,6 +8511,10 @@ let
     stdenv = overrideGCC stdenv gcc34;
   };
 
+  qemuSVN = import ../applications/virtualization/qemu/svn-6642.nix {
+    inherit fetchsvn SDL zlib which stdenv;
+  };
+
   qemuImage = composedArgsAndFun
     (selectVersion ../applications/virtualization/qemu/linux-img "0.2") {
     inherit builderDefs fetchurl stdenv;
@@ -8349,13 +8595,12 @@ let
   sox = import ../applications/misc/audio/sox {
     inherit fetchurl stdenv lib composableDerivation;
     # optional features
-    inherit alsaLib libao;
+    inherit alsaLib libao ffmpeg;
     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':
     # /tmp/nix-7957-1/sox-14.0.0/src/ffmpeg.c:130: undefined reference to `avcodec_decode_audio2
     # That's why I'v added ffmpeg_svn
-    ffmpeg = ffmpeg_svn;
   };
 
   spoofax = import ../applications/editors/eclipse/plugins/spoofax {
@@ -8471,6 +8716,21 @@ let
     #enableOfficialBranding = true;
   };
 
+  /*
+  Despaired. Looks like ThunderBird-on-Firefox's-Xulrunner is non-trivial
+
+  thunderbird3 = lowPrio (import ../applications/networking/mailreaders/thunderbird-3.x {
+    inherit fetchurl stdenv pkgconfig perl zip libjpeg zlib cairo
+      python dbus dbus_glib freetype fontconfig bzip2 libpng alsaLib sqlite
+      patchelf;
+    inherit (gtkLibs) gtk pango;
+    inherit (gnome) libIDL;
+    #enableOfficialBranding = true;
+    xulrunner = xulrunner3;
+    autoconf = autoconf213;
+  });*/
+
+
   timidity = import ../tools/misc/timidity {
     inherit fetchurl stdenv alsaLib;
   };
@@ -8539,12 +8799,10 @@ let
   virtualbox = virtualboxFun null;*/
 
   vlc = import ../applications/video/vlc {
-    inherit fetchurl stdenv perl x11 wxGTK
-            zlib mpeg2dec a52dec libmad
-            libdvdread libdvdnav libdvdcss;
-    inherit (xlibs) libXv;
+    inherit fetchurl stdenv perl xlibs zlib a52dec libmad faad2
+      ffmpeg libdvdnav pkgconfig hal fribidi qt4 freefont_ttf;
+    dbus = dbus.libs;
     alsa = alsaLib;
-    ffmpeg = ffmpeg_svn;
   };
 
   vorbisTools = import ../applications/audio/vorbis-tools {
@@ -8579,8 +8837,7 @@ let
   wrapFirefox = browser: browserName: nameSuffix: import ../applications/networking/browsers/firefox-wrapper {
     inherit stdenv nameSuffix makeWrapper browser browserName;
     plugins =
-      let enableAdobeFlash = getConfig [ browserName "enableAdobeFlash" ] true
-            && system == "i686-linux";
+      let enableAdobeFlash = getConfig [ browserName "enableAdobeFlash" ] true;
       in
        ([]
         ++ lib.optional (!enableAdobeFlash) gnash
@@ -8592,14 +8849,14 @@ let
        );
   };
 
-  x11vnc =  composedArgsAndFun (selectVersion ../tools/X11/x11vnc "0.9.3") {
+  x11vnc = composedArgsAndFun (selectVersion ../tools/X11/x11vnc "0.9.3") {
     inherit builderDefs openssl zlib libjpeg ;
     inherit (xlibs) libXfixes fixesproto libXdamage damageproto
       libX11 xproto libXtst libXinerama xineramaproto libXrandr randrproto
       libXext xextproto inputproto recordproto;
   };
 
-  x2vnc =  composedArgsAndFun (selectVersion ../tools/X11/x2vnc "1.7.2") {
+  x2vnc = composedArgsAndFun (selectVersion ../tools/X11/x2vnc "1.7.2") {
     inherit builderDefs;
     inherit (xlibs) libX11 xproto xextproto libXext libXrandr randrproto;
   };
@@ -8696,7 +8953,7 @@ let
     pyrex = pyrex095;
   };
 
-  xscreensaverBase =  composedArgsAndFun (import ../applications/graphics/xscreensaver) {
+  xscreensaverBase = composedArgsAndFun (import ../applications/graphics/xscreensaver) {
     inherit stdenv fetchurl builderDefs lib pkgconfig bc perl intltool;
     inherit (xlibs) libX11 libXmu;
   };
@@ -8745,7 +9002,7 @@ let
   };
 
   # doesn't compile yet - in case someone else want's to continue ..
-  qgis =  composedArgsAndFun (selectVersion ../applications/misc/qgis "0.11.0") {
+  qgis =  (selectVersion ../applications/misc/qgis "0.11.0") {
     inherit composableDerivation fetchsvn stdenv flex lib
             ncurses fetchurl perl cmake gdal geos proj x11
             gsl libpng zlib bison
@@ -8781,7 +9038,7 @@ let
     inherit fetchurl stdenv python pygame twisted lib numeric makeWrapper;
   };
 
-  construoBase =  composedArgsAndFun (selectVersion ../games/construo "0.2.2") {
+  construoBase = composedArgsAndFun (selectVersion ../games/construo "0.2.2") {
     inherit stdenv fetchurl builderDefs
       zlib;
     inherit (xlibs) libX11 xproto;
@@ -8873,7 +9130,7 @@ let
   };
 
   # You still can override by passing more arguments.
-  spaceOrbit =  composedArgsAndFun (selectVersion ../games/orbit "1.01") {
+  spaceOrbit = composedArgsAndFun (selectVersion ../games/orbit "1.01") {
     inherit fetchurl stdenv builderDefs mesa freeglut;
     inherit (gnome) esound;
     inherit (xlibs) libXt libX11 libXmu libXi libXext;
@@ -8908,6 +9165,10 @@ let
     inherit (xlibs) libX11 xproto libXpm libXt;
   };
 
+  zdoom = import ../games/zdoom {
+    inherit cmake stdenv fetchsvn SDL nasm p7zip zlib flac fmod libjpeg;
+  };
+
   zoom = import ../games/zoom {
     inherit fetchurl stdenv perl expat freetype;
     inherit (xlibs) xlibs;
@@ -8933,18 +9194,31 @@ let
       gettext x11 libtiff libjpeg libpng gtkLibs xlibs bzip2
       libcm python dbus_glib ncurses which libxml2Python
       iconnamingutils openssl hal samba fam libgcrypt libtasn1
-      xmlto  docbook2x  docbook_xsl intltool;
+      xmlto docbook2x docbook_xsl intltool;
   });
 
-  kdelibs = import ../desktops/kde/kdelibs {
-    inherit
-      fetchurl stdenv xlibs zlib perl openssl pcre pkgconfig
-      libjpeg libpng libtiff libxml2 libxslt libtool
-      expat freetype bzip2 cups attr acl;
-    qt = qt3;
+  kde3 = {
+
+    kdelibs = import ../desktops/kde-3/kdelibs {
+      inherit
+        fetchurl stdenv xlibs zlib perl openssl pcre pkgconfig
+        libjpeg libpng libtiff libxml2 libxslt libtool
+        expat freetype bzip2 cups attr acl;
+      qt = qt3;
+    };
+
+    kdebase = import ../desktops/kde-3/kdebase {
+      inherit
+        fetchurl stdenv pkgconfig x11 xlibs zlib libpng libjpeg perl
+        kdelibs openssl bzip2 fontconfig pam hal dbus;
+      inherit (gtkLibs) glib;
+      qt = qt3;
+    };
+
   };
 
-  kde4 = recurseIntoAttrs (import ../desktops/kde-4 {
+  /*
+  kde4 = recurseIntoAttrs (import ../desktops/kde-4-old {
     inherit
       fetchurl fetchsvn zlib perl openssl pcre pkgconfig libjpeg libpng libtiff
       libxml2 libxslt libtool libusb expat freetype bzip2 cmake cluceneCore libgcrypt gnupg
@@ -8965,19 +9239,18 @@ let
     qt = qt4;
     openexr = openexr_1_6_1 ;
   });
+  */
+
+  kde4 = kde42;
 
   kde42 = import ../desktops/kde-4.2 (pkgs // {
     openexr = openexr_1_6_1;
   });
 
-  kdebase = import ../desktops/kde/kdebase {
-    inherit
-      fetchurl stdenv pkgconfig x11 xlibs zlib libpng libjpeg perl
-      kdelibs openssl bzip2 fontconfig pam hal dbus;
-    inherit (gtkLibs) glib;
-    qt = qt3;
-  };
+  kdelibs = kde3.kdelibs;
+  kdebase = kde3.kdebase;
 
+  
   ### SCIENCE/GEOMETRY
 
   drgeo = builderDefsPackage (import ../applications/science/geometry/drgeo) {
@@ -9115,18 +9388,15 @@ let
     inherit (gtkLibs1x) gtk;
   };
 
-  ghostscript = import ../misc/ghostscript {
+  ghostscript = makeOverridable (import ../misc/ghostscript) {
     inherit fetchurl stdenv libjpeg libpng libtiff zlib x11 pkgconfig
       fontconfig cups openssl;
     x11Support = false;
-    cupsSupport = true;
+    cupsSupport = getPkgConfig "ghostscript" "cups" true;
   };
 
-  ghostscriptX = lowPrio (appendToName "with-X" (import ../misc/ghostscript {
-    inherit fetchurl stdenv libjpeg libpng libtiff zlib x11 pkgconfig
-      fontconfig cups openssl;
+  ghostscriptX = lowPrio (appendToName "with-X" (ghostscript.override {
     x11Support = true;
-    cupsSupport = true;
   }));
 
   gxemul = (import ../misc/gxemul) {
@@ -9177,7 +9447,7 @@ let
   };
 
   # The bleeding edge.
-  nixUnstable = import ../tools/package-management/nix/unstable.nix {
+  nixUnstable = makeOverridable (import ../tools/package-management/nix/unstable.nix) {
     inherit fetchurl stdenv perl curl bzip2 openssl;
     aterm = aterm242fixes;
     db4 = db45;
@@ -9290,7 +9560,7 @@ let
   */
 
   texFunctions = import ../misc/tex/nix {
-    inherit stdenv perl tetex graphviz ghostscript makeFontsConf;
+    inherit stdenv perl tetex graphviz ghostscript makeFontsConf imagemagick;
   };
 
   texLive = builderDefsPackage (import ../misc/tex/texlive) {
@@ -9378,4 +9648,5 @@ let
     inherit (stdenv) mkDerivation;
   };
 
+  libTests = import ../lib/tests.nix;
 }; in pkgs
diff --git a/pkgs/top-level/build-for-release.nix b/pkgs/top-level/build-for-release.nix
index e7cdaa0d8a05..69c2a4ecc122 100644
--- a/pkgs/top-level/build-for-release.nix
+++ b/pkgs/top-level/build-for-release.nix
@@ -28,6 +28,7 @@ let
       bzip2
       cabextract
       cdrkit
+      cedet
       chatzilla
       cksfv
       #compiz
@@ -45,6 +46,7 @@ let
       docbook_xml_dtd_42
       docbook_xml_dtd_43
       docbook_xsl
+      doxygen
       e2fsprogs
       emacs
       emacsUnicode
@@ -78,6 +80,7 @@ let
       gnutar
       gnutls
       gphoto2
+      gprolog
       gsl
       guile
       gqview
@@ -124,6 +127,7 @@ let
       #mythtv
       nano
       netcat
+      nfsUtils
       nix
       nixUnstable
       nss_ldap
@@ -140,9 +144,11 @@ let
       par2cmdline
       pciutils
       perl
+      perlTaskCatalystTutorial
       php
       pinentry
       pkgconfig
+      portmap
       postgresql
       procps
       pwdutils
@@ -209,6 +215,7 @@ let
       xsel
       xterm
       zdelta
+      zile
       zip
       ;
     inherit (pkgs.xorg)
@@ -240,6 +247,27 @@ let
       gnomeutils
       metacity
       ;
+    kde42 = pkgs.recurseIntoAttrs {
+      inherit (pkgs.kde42)
+        kdelibs
+        kdebase_workspace
+        kdebase
+        kdebase_runtime
+	kdegraphics
+	kdemultimedia
+	kdegames
+	kdeadmin
+	kdeedu
+	kdeartwork
+	kdesdk
+	kdeutils
+	kdetoys
+	kdewebdev
+	kdenetwork
+	kdepim
+	kdeplasma_addons
+        ;
+    };
     kernelPackages_2_6_23 = pkgs.recurseIntoAttrs {
       inherit (pkgs.kernelPackages_2_6_23)
         iwlwifi
diff --git a/pkgs/top-level/make-tarball.nix b/pkgs/top-level/make-tarball.nix
new file mode 100644
index 000000000000..d6e3a118d44a
--- /dev/null
+++ b/pkgs/top-level/make-tarball.nix
@@ -0,0 +1,75 @@
+/* Hydra job to build a tarball for Nixpkgs from a SVN checkout.  It
+   also builds the documentation and tests whether the Nix expressions
+   evaluate correctly. */
+
+{ nixpkgs ? {outPath = (import ./all-packages.nix {}).lib.cleanSource ../..; rev = 1234;}
+, officialRelease ? false
+}:
+
+with import nixpkgs.outPath {};
+
+releaseTools.makeSourceTarball {
+  name = "nixpkgs-tarball";
+  src = nixpkgs;
+  inherit officialRelease;
+
+  buildInputs = [
+    lzma
+    libxml2 # Needed for the release notes.
+    libxslt
+    w3m
+    nixUnstable # Needed to check whether the expressions are valid.
+  ];
+
+  configurePhase = ''
+    eval "$preConfigure"
+    releaseName=nixpkgs-$(cat $src/VERSION)$VERSION_SUFFIX
+    echo "release name is $releaseName"
+    echo $releaseName > relname
+  '';
+
+  dontBuild = false;
+
+  buildPhase = ''
+    echo "building docs..."
+    (cd doc && make docbookxsl=${docbook5_xsl}/xml/xsl/docbook) || false
+    ln -s doc/NEWS.txt NEWS
+  '';
+
+  doCheck = true;
+
+  checkPhase = ''
+    # Check that we can fully evaluate build-for-release.nix.
+    header "checking pkgs/top-level/build-for-release.nix"
+    nix-env --readonly-mode -f pkgs/top-level/build-for-release.nix \
+        -qa \* --drv-path --system-filter \* --system
+    stopNest
+
+    # Check that all-packages.nix evaluates on a number of platforms.
+    for platform in i686-linux x86_64-linux powerpc-linux i686-freebsd powerpc-darwin i686-darwin; do
+        header "checking pkgs/top-level/all-packages.nix on $platform"
+        nix-env --readonly-mode -f pkgs/top-level/all-packages.nix \
+            --argstr system "$platform" \
+            -qa \* --drv-path --system-filter \* --system
+        stopNest
+    done
+  '';
+
+  distPhase = ''
+    ensureDir $out/tarballs
+    mkdir ../$releaseName
+    cp -prd . ../$releaseName
+    (cd .. && tar cfa $out/tarballs/$releaseName.tar.bz2 $releaseName) || false
+    (cd .. && tar cfa $out/tarballs/$releaseName.tar.lzma $releaseName) || false
+
+    ensureDir $out/release-notes
+    cp doc/NEWS.html $out/release-notes/index.html
+    cp doc/style.css $out/release-notes/
+    echo "doc release-notes $out/release-notes" >> $out/nix-support/hydra-build-products
+
+    ensureDir $out/manual
+    cp doc/manual.html $out/manual/index.html
+    cp doc/style.css $out/manual/
+    echo "doc manual $out/manual" >> $out/nix-support/hydra-build-products
+  '';
+}
diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix
index 9436457a09b8..d2a4da2cecfd 100644
--- a/pkgs/top-level/release.nix
+++ b/pkgs/top-level/release.nix
@@ -2,102 +2,150 @@ let
 
   allPackages = import ./all-packages.nix;
 
-  test = f: {system}: f (allPackages {inherit system;});
-  
+  pkgs = allPackages {};
+
+  /* Perform a job on the given set of platforms.  The function `f' is
+     called by Hydra for each platform, and should return some job
+     to build on that platform.  `f' is passed the Nixpkgs collection
+     for the platform in question. */
+  testOn = systems: f: {system ? builtins.currentSystem}:
+    if pkgs.lib.elem system systems then f (allPackages {inherit system;}) else {};
+
+  /* Map an attribute of the form `foo = [platforms...]'  to `testOn
+     [platforms...] (pkgs: pkgs.foo)'. */
+  mapTestOn = pkgs.lib.mapAttrsRecursive
+    (path: value: testOn value (pkgs: pkgs.lib.getAttrFromPath path pkgs));
+
+  /* Common platform groups on which to test packages. */
+  all = ["i686-linux" "x86_64-linux" "i686-darwin" "i686-cygwin"];
+  linux = ["i686-linux" "x86_64-linux"];
+  allBut = (platform: pkgs.lib.filter (x: platform != x) all);
+
+in {
+
+  tarball = import ./make-tarball.nix;
+
+} // mapTestOn {
+
+  MPlayer = linux;
+  apacheHttpd = linux;
+  at = linux;
+  autoconf = all;
+  avahi = allBut "i686-cygwin";  # Cygwin builds fail
+  bash = all;
+  bazaar = all;
+  bitlbee = linux;
+  boost = all;
+  cdrkit = linux;
+  cedet = all;
+  emacs22 = all;
+  emacsUnicode = all;
+  emms = all;
+  eprover = linux;
+  evince = all;
+  firefox3 = linux;
+  gcc = all;
+  gdb = all;
+  ghostscript = all;
+  ghostscriptX = all;
+  git = all;
+  gnuplot = all;
+  gnuplotX = linux;
+  gnutls = all;
+  graphviz = all;
+  guile = linux;  # tests fail on Cygwin
+  guileLib = linux;
+  hello = all;
+  icecat3Xul = [ "i686-linux" ];
+  idutils = all;
+  imagemagick = all;
+  inetutils = linux;
+  inkscape = linux;
+  jnettop = linux;
+  kernel_2_6_28 = linux;
+  libsmbios = linux;
+  libtool = all;
+  lout = linux;
+  lsh = linux;
+  manpages = all;
+  maxima = all;
+  mercurial = all;
+  mesa = linux;
+  monotone = all;
+  mysql = all;
+  nano = all;
+  nssmdns = linux;
+  ntfs3g = linux;
+  octave = all;
+  openoffice = linux;
+  openssh = all;
+  pan = linux;
+  perl = all;
+  pidgin = all;
+  pltScheme = linux;
+  pmccabe = all;
+  portmap = linux;
+  postgresql = all;
+  python = all;
+  pythonFull = linux;
+  rubber = all;
+  ruby = all;
+  qt3 = all;
+  qt4 = all;
+  rsync = all;
+  sloccount = all;
+  strace = linux;
+  subversion = linux;
+  tcpdump = linux;
+  texinfo = all;
+  texLive = linux;
+  thunderbird = linux;
+  vimHugeX = all;
+  vlc = linux;
+  webkit = all;
+  wine = ["i686-linux"];
+  wirelesstools = linux;
+  xlockmore = linux;
+  xpdf = linux;
+  zile = linux;
+
+  gtkLibs = {
+    gtk = linux;
+  };
 
-  jobs = {
+  kde42 = {
+    kdeadmin = linux;
+    kdeartwork = linux;
+    kdebase = linux;
+    kdebase_runtime = linux;
+    kdebase_workspace = linux;
+    kdeedu = linux;
+    kdegames = linux;
+    kdegraphics = linux;
+    kdelibs = linux;
+    kdemultimedia = linux;
+    kdenetwork = linux;
+    kdepim = linux;
+    kdeplasma_addons = linux;
+    kdesdk = linux;
+    kdetoys = linux;
+    kdeutils = linux;
+    kdewebdev = linux;
+  };
 
+  kernelPackages_2_6_27 = {
+    aufs = linux;
+    kernel = linux;
+  };
   
-    tarball =
-      { nixpkgs ? {path = (allPackages {}).lib.cleanSource ../..; rev = 1234;}
-      , officialRelease ? false
-      }:
-
-      with import nixpkgs.path {};
-
-      releaseTools.makeSourceTarball {
-        name = "nixpkgs-tarball";
-        src = nixpkgs;
-        inherit officialRelease;
-
-        buildInputs = [
-          lzma
-          libxml2 # Needed for the release notes.
-          libxslt
-          w3m
-          nixUnstable # Needed to check whether the expressions are valid.
-        ];
-    
-        configurePhase = ''
-          eval "$preConfigure"
-          releaseName=nixpkgs-$(cat $src/VERSION)$VERSION_SUFFIX
-          echo "release name is $releaseName"
-          echo $releaseName > relname
-        '';
-
-        dontBuild = false;
-                
-        buildPhase = ''
-          echo "building docs..."
-          (cd doc && make docbookxsl=${docbook5_xsl}/xml/xsl/docbook) || false
-          ln -s doc/NEWS.txt NEWS
-        '';
- 
-        doCheck = true;
-
-        checkPhase = ''
-          # Check that we can fully evaluate build-for-release.nix.
-          header "checking pkgs/top-level/build-for-release.nix"
-          nix-env --readonly-mode -f pkgs/top-level/build-for-release.nix \
-              -qa \* --drv-path --system-filter \* --system
-          stopNest
-
-          # Check that all-packages.nix evaluates on a number of platforms.
-          for platform in i686-linux x86_64-linux powerpc-linux i686-freebsd powerpc-darwin i686-darwin; do
-              header "checking pkgs/top-level/all-packages.nix on $platform"
-              nix-env --readonly-mode -f pkgs/top-level/all-packages.nix \
-                  --argstr system "$platform" \
-                  -qa \* --drv-path --system-filter \* --system
-              stopNest
-          done
-        '';
-
-        distPhase = ''
-          ensureDir $out/tarballs
-          mkdir ../$releaseName
-          cp -prd . ../$releaseName
-          (cd .. && tar cfa $out/tarballs/$releaseName.tar.bz2 $releaseName) || false
-          (cd .. && tar cfa $out/tarballs/$releaseName.tar.lzma $releaseName) || false
-
-          ensureDir $out/release-notes
-          cp doc/NEWS.html $out/release-notes/index.html
-          cp doc/style.css $out/release-notes/
-          echo "doc release-notes $out/release-notes" >> $out/nix-support/hydra-build-products
-
-          ensureDir $out/manual
-          cp doc/manual.html $out/manual/index.html
-          cp doc/style.css $out/manual/
-          echo "doc manual $out/manual" >> $out/nix-support/hydra-build-products
-        '';
-      };
-
-
-      # All the top-level packages that want to build in the build farm.
-      # !!! notation is kinda clumsy
-
-      MPlayer = test (pkgs: pkgs.MPlayer);
-      autoconf = test (pkgs: pkgs.autoconf);
-      bash = test (pkgs: pkgs.bash);
-      firefox3 = test (pkgs: pkgs.firefox3);
-      gcc = test (pkgs: pkgs.gcc);
-      hello = test (pkgs: pkgs.hello);
-      libtool = test (pkgs: pkgs.libtool);
-      pan = test (pkgs: pkgs.pan);
-      perl = test (pkgs: pkgs.perl);
-      python = test (pkgs: pkgs.python);
-      thunderbird = test (pkgs: pkgs.thunderbird);
-      wine = test (pkgs: pkgs.wine);
-              
+  kernelPackages_2_6_28 = {
+    aufs = linux;
+    kernel = linux;
+  };
+  
+  xorg = {
+    libX11 = linux;
+    xorgserver = linux;
   };
 
-in jobs
+}