summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/altcoins/bitcoin-xt.nix2
-rw-r--r--pkgs/applications/audio/ardour/default.nix2
-rw-r--r--pkgs/applications/audio/audacity/default.nix14
-rw-r--r--pkgs/applications/audio/flac/default.nix4
-rw-r--r--pkgs/applications/audio/google-musicmanager/default.nix2
-rw-r--r--pkgs/applications/audio/spotify/default.nix8
-rw-r--r--pkgs/applications/audio/swh-lv2/default.nix2
-rw-r--r--pkgs/applications/audio/yoshimi/default.nix2
-rw-r--r--pkgs/applications/display-managers/slim/default.nix4
-rw-r--r--pkgs/applications/editors/codeblocks/default.nix2
-rw-r--r--pkgs/applications/editors/eclipse/default.nix8
-rw-r--r--pkgs/applications/editors/edbrowse/default.nix2
-rw-r--r--pkgs/applications/editors/emacs-24/default.nix2
-rw-r--r--pkgs/applications/editors/emacs-24/macport-24.3.nix6
-rw-r--r--pkgs/applications/editors/heme/default.nix5
-rw-r--r--pkgs/applications/editors/idea/default.nix2
-rw-r--r--pkgs/applications/editors/lighttable/default.nix4
-rw-r--r--pkgs/applications/editors/music/tuxguitar/default.nix2
-rw-r--r--pkgs/applications/graphics/darktable/default.nix16
-rw-r--r--pkgs/applications/graphics/feh/default.nix4
-rw-r--r--pkgs/applications/graphics/seg3d/default.nix4
-rw-r--r--pkgs/applications/graphics/shotwell/default.nix2
-rw-r--r--pkgs/applications/graphics/xfig/default.nix2
-rw-r--r--pkgs/applications/kde-apps-15.08/kdelibs/default.nix4
-rw-r--r--pkgs/applications/misc/audio/soxr/default.nix2
-rw-r--r--pkgs/applications/misc/calibre/default.nix4
-rw-r--r--pkgs/applications/misc/djvulibre/default.nix2
-rw-r--r--pkgs/applications/misc/get_iplayer/default.nix2
-rw-r--r--pkgs/applications/misc/girara/default.nix2
-rw-r--r--pkgs/applications/misc/ikiwiki/default.nix2
-rw-r--r--pkgs/applications/misc/mysql-workbench/default.nix2
-rw-r--r--pkgs/applications/misc/pinfo/default.nix2
-rw-r--r--pkgs/applications/misc/roxterm/default.nix8
-rw-r--r--pkgs/applications/misc/surf/default.nix2
-rw-r--r--pkgs/applications/misc/sweethome3d/default.nix2
-rw-r--r--pkgs/applications/misc/sweethome3d/editors.nix2
-rw-r--r--pkgs/applications/misc/tilda/default.nix2
-rw-r--r--pkgs/applications/misc/xca/default.nix3
-rw-r--r--pkgs/applications/misc/xneur/default.nix14
-rw-r--r--pkgs/applications/misc/zathura/core/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix6
-rw-r--r--pkgs/applications/networking/browsers/dwb/default.nix4
-rw-r--r--pkgs/applications/networking/browsers/jumanji/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/luakit/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/midori/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/mozilla-plugins/gecko-mediaplayer/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/uzbl/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/vimb/default.nix2
-rw-r--r--pkgs/applications/networking/browsers/vimprobable2/default.nix2
-rw-r--r--pkgs/applications/networking/copy-com/default.nix2
-rw-r--r--pkgs/applications/networking/feedreaders/newsbeuter/dev.nix2
-rw-r--r--pkgs/applications/networking/ike/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/blink/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/carrier/2.5.0.nix10
-rw-r--r--pkgs/applications/networking/instant-messengers/oneteam/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/pidgin/default.nix10
-rw-r--r--pkgs/applications/networking/instant-messengers/sflphone/default.nix2
-rw-r--r--pkgs/applications/networking/instant-messengers/telepathy/kde/default.nix6
-rw-r--r--pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix2
-rw-r--r--pkgs/applications/networking/newsreaders/liferea/default.nix2
-rw-r--r--pkgs/applications/networking/p2p/retroshare/0.6.nix2
-rw-r--r--pkgs/applications/networking/p2p/retroshare/default.nix2
-rw-r--r--pkgs/applications/networking/spideroak/default.nix2
-rw-r--r--pkgs/applications/science/astronomy/celestia/default.nix2
-rw-r--r--pkgs/applications/science/electronics/tkgate/1.x.nix4
-rw-r--r--pkgs/applications/science/electronics/tkgate/2.x.nix4
-rw-r--r--pkgs/applications/science/logic/hol/default.nix2
-rw-r--r--pkgs/applications/science/logic/saw-tools/default.nix2
-rw-r--r--pkgs/applications/science/logic/tptp/default.nix2
-rw-r--r--pkgs/applications/science/logic/yices/default.nix8
-rw-r--r--pkgs/applications/search/recoll/default.nix8
-rw-r--r--pkgs/applications/version-management/git-and-tools/svn2git-kde/default.nix2
-rw-r--r--pkgs/applications/version-management/rabbitvcs/default.nix2
-rw-r--r--pkgs/applications/version-management/rapidsvn/default.nix4
-rw-r--r--pkgs/applications/version-management/redmine/bootstrap.nix4
-rw-r--r--pkgs/applications/version-management/subversion/default.nix9
-rw-r--r--pkgs/applications/video/avidemux/default.nix4
-rw-r--r--pkgs/applications/video/clipgrab/default.nix4
-rw-r--r--pkgs/applications/video/dvd-slideshow/default.nix2
-rw-r--r--pkgs/applications/video/gnash/default.nix4
-rw-r--r--pkgs/applications/video/kazam/default.nix4
-rw-r--r--pkgs/applications/video/kodi/default.nix10
-rw-r--r--pkgs/applications/video/miro/default.nix4
-rw-r--r--pkgs/applications/video/vlc/default.nix2
-rw-r--r--pkgs/applications/virtualization/bochs/default.nix4
-rw-r--r--pkgs/applications/virtualization/virtualbox/default.nix10
-rw-r--r--pkgs/applications/virtualization/virtualbox/guest-additions/default.nix8
-rw-r--r--pkgs/applications/virtualization/xen/generic.nix2
-rw-r--r--pkgs/applications/window-managers/awesome/default.nix8
-rw-r--r--pkgs/applications/window-managers/qtile/default.nix12
-rw-r--r--pkgs/applications/window-managers/weston/default.nix2
91 files changed, 191 insertions, 172 deletions
diff --git a/pkgs/applications/altcoins/bitcoin-xt.nix b/pkgs/applications/altcoins/bitcoin-xt.nix
index e6c95729c6e..c1411307668 100644
--- a/pkgs/applications/altcoins/bitcoin-xt.nix
+++ b/pkgs/applications/altcoins/bitcoin-xt.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec{
 
   configureFlags = [
     "--with-boost-libdir=${boost.lib}/lib"
-    "--with-libcurl-headers=${curl}/include"
+    "--with-libcurl-headers=${curl.dev}/include"
   ] ++ optionals withGui [ "--with-gui=qt4" ];
 
   meta = {
diff --git a/pkgs/applications/audio/ardour/default.nix b/pkgs/applications/audio/ardour/default.nix
index f44f1a2b78a..c10a0d8a4ce 100644
--- a/pkgs/applications/audio/ardour/default.nix
+++ b/pkgs/applications/audio/ardour/default.nix
@@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
   # have to do that ourself.
   patchPhase = ''
     printf '#include "libs/ardour/ardour/revision.h"\nnamespace ARDOUR { const char* revision = \"${tag}-${builtins.substring 0 8 src.rev}\"; }\n' > libs/ardour/revision.cc
-    sed 's|/usr/include/libintl.h|${glibc}/include/libintl.h|' -i wscript
+    sed 's|/usr/include/libintl.h|${glibc.dev}/include/libintl.h|' -i wscript
     patchShebangs ./tools/
   '';
 
diff --git a/pkgs/applications/audio/audacity/default.nix b/pkgs/applications/audio/audacity/default.nix
index 67ec6b5a419..221955e2bf9 100644
--- a/pkgs/applications/audio/audacity/default.nix
+++ b/pkgs/applications/audio/audacity/default.nix
@@ -12,6 +12,12 @@ stdenv.mkDerivation rec {
     sha256 = "0y9bvc3a3zxsk31yg7bha029mzkjiw5i9m86kbyj7x8ps0fm91z2";
   };
 
+  # fix with gcc-5 from http://lists.freebsd.org/pipermail/freebsd-ports-bugs/2012-December/245884.html
+  postPatch = ''
+    substituteInPlace lib-src/libnyquist/nyquist/ffts/src/fftlib.c \
+      --replace 'inline void' 'static inline void'
+  '';
+
   preConfigure = /* we prefer system-wide libs */ ''
     mv lib-src lib-src-rm
     mkdir lib-src
@@ -30,11 +36,11 @@ stdenv.mkDerivation rec {
   dontDisableStatic = true;
   doCheck = true;
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "Sound editor with graphical UI";
     homepage = http://audacity.sourceforge.net;
-    license = stdenv.lib.licenses.gpl2Plus;
-    platforms = with stdenv.lib.platforms; linux;
-    maintainers = with stdenv.lib.maintainers; [ the-kenny ];
+    license = licenses.gpl2Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.the-kenny ];
   };
 }
diff --git a/pkgs/applications/audio/flac/default.nix b/pkgs/applications/audio/flac/default.nix
index 18fb48a17ba..80e4e49fb18 100644
--- a/pkgs/applications/audio/flac/default.nix
+++ b/pkgs/applications/audio/flac/default.nix
@@ -8,12 +8,12 @@ stdenv.mkDerivation rec {
     sha256 = "4773c0099dba767d963fd92143263be338c48702172e8754b9bc5103efe1c56c";
   };
 
-  outputs = [ "out" "doc" ];
-
   buildInputs = [ libogg ];
 
   #doCheck = true; # takes lots of time
 
+  outputs = [ "dev" "out" "bin" "doc" ];
+
   meta = with stdenv.lib; {
     homepage = http://xiph.org/flac/;
     description = "Library and tools for encoding and decoding the FLAC lossless audio file format";
diff --git a/pkgs/applications/audio/google-musicmanager/default.nix b/pkgs/applications/audio/google-musicmanager/default.nix
index 7c69a25eb04..8127579f022 100644
--- a/pkgs/applications/audio/google-musicmanager/default.nix
+++ b/pkgs/applications/audio/google-musicmanager/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
   buildPhase = ''
     patchelf \
       --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
-      --set-rpath "$out/opt/google/musicmanager:${readline}/lib:${ncurses}/lib:${stdenv.cc.libc}/lib:${qt48}/lib:${stdenv.cc.cc}/lib:${libidn}/lib:${expat}/lib:${flac}/lib:${libvorbis}/lib" opt/google/musicmanager/MusicManager
+      --set-rpath "$out/opt/google/musicmanager:${stdenv.lib.makeLibraryPath [ readline ncurses stdenv.cc.libc.out qt48 stdenv.cc.cc libidn expat flac libvorbis ]}" opt/google/musicmanager/MusicManager
   '';
 
   dontPatchELF = true;
diff --git a/pkgs/applications/audio/spotify/default.nix b/pkgs/applications/audio/spotify/default.nix
index 2868d760973..d9983a32685 100644
--- a/pkgs/applications/audio/spotify/default.nix
+++ b/pkgs/applications/audio/spotify/default.nix
@@ -66,10 +66,10 @@ stdenv.mkDerivation {
       # Work around Spotify referring to a specific minor version of
       # OpenSSL.
 
-      ln -s ${openssl}/lib/libssl.so $libdir/libssl.so.1.0.0
-      ln -s ${openssl}/lib/libcrypto.so $libdir/libcrypto.so.1.0.0
-      ln -s ${nspr}/lib/libnspr4.so $libdir/libnspr4.so
-      ln -s ${nspr}/lib/libplc4.so $libdir/libplc4.so
+      ln -s ${openssl.out}/lib/libssl.so $libdir/libssl.so.1.0.0
+      ln -s ${openssl.out}/lib/libcrypto.so $libdir/libcrypto.so.1.0.0
+      ln -s ${nspr.out}/lib/libnspr4.so $libdir/libnspr4.so
+      ln -s ${nspr.out}/lib/libplc4.so $libdir/libplc4.so
 
       mkdir -p $out/bin
 
diff --git a/pkgs/applications/audio/swh-lv2/default.nix b/pkgs/applications/audio/swh-lv2/default.nix
index 2955a9371ff..4bc7801637c 100644
--- a/pkgs/applications/audio/swh-lv2/default.nix
+++ b/pkgs/applications/audio/swh-lv2/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   };
 
   patchPhase = ''
-    sed -e "s#xsltproc#${libxslt}/bin/xsltproc#" -i Makefile
+    sed -e "s#xsltproc#${libxslt.bin}/bin/xsltproc#" -i Makefile
     sed -e "s#PREFIX = /usr/local#PREFIX = $out#" -i Makefile
   '';
 
diff --git a/pkgs/applications/audio/yoshimi/default.nix b/pkgs/applications/audio/yoshimi/default.nix
index dc2fe0ba649..f26434f6f20 100644
--- a/pkgs/applications/audio/yoshimi/default.nix
+++ b/pkgs/applications/audio/yoshimi/default.nix
@@ -22,7 +22,7 @@ stdenv.mkDerivation  rec {
 
   preConfigure = "cd src";
 
-  cmakeFlags = [ "-DFLTK_MATH_LIBRARY=${stdenv.glibc}/lib/libm.so" ];
+  cmakeFlags = [ "-DFLTK_MATH_LIBRARY=${stdenv.glibc.out}/lib/libm.so" ];
 
   meta = with stdenv.lib; {
     description = "high quality software synthesizer based on ZynAddSubFX";
diff --git a/pkgs/applications/display-managers/slim/default.nix b/pkgs/applications/display-managers/slim/default.nix
index 42d2c777aea..f3147ca5187 100644
--- a/pkgs/applications/display-managers/slim/default.nix
+++ b/pkgs/applications/display-managers/slim/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, cmake, pkgconfig, xorg, libjpeg, libpng
-, fontconfig, freetype, pam, dbus_libs, makeWrapper, pkgs }:
+, fontconfig, freetype, pam, dbus_libs, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "slim-1.3.6";
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ cmake pkgconfig libjpeg libpng fontconfig freetype
-      pam dbus_libs
+      pam dbus_libs (stdenv.cc.libc.out or null)
       xorg.libX11 xorg.libXext xorg.libXrandr xorg.libXrender xorg.libXmu xorg.libXft makeWrapper
     ];
 
diff --git a/pkgs/applications/editors/codeblocks/default.nix b/pkgs/applications/editors/codeblocks/default.nix
index 53b7b5750a0..76df6d4d2b9 100644
--- a/pkgs/applications/editors/codeblocks/default.nix
+++ b/pkgs/applications/editors/codeblocks/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
   patches = [ ./writable-projects.patch ];
   preConfigure = "substituteInPlace ./configure --replace /usr/bin/file ${file}/bin/file";
-  postConfigure = optionalString stdenv.isLinux "substituteInPlace libtool --replace ldconfig ${stdenv.cc.libc}/sbin/ldconfig";
+  postConfigure = optionalString stdenv.isLinux "substituteInPlace libtool --replace ldconfig ${stdenv.cc.libc.bin}/bin/ldconfig";
   configureFlags = [ "--enable-pch=no" ]
     ++ optional contribPlugins "--with-contrib-plugins";
 
diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix
index 7d543c4ed55..9d47cc5993a 100644
--- a/pkgs/applications/editors/eclipse/default.nix
+++ b/pkgs/applications/editors/eclipse/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeDesktopItem, makeWrapper
+{ stdenv, lib, fetchurl, makeDesktopItem, makeWrapper
 , freetype, fontconfig, libX11, libXext, libXrender, zlib
 , glib, gtk, libXtst, jre
 , webkitgtk2 ? null  # for internal web browser
@@ -34,10 +34,10 @@ let
         tar xfvz $src -C $out
 
         # Patch binaries.
-        interpreter=$(echo ${stdenv.glibc}/lib/ld-linux*.so.2)
+        interpreter=$(echo ${stdenv.glibc.out}/lib/ld-linux*.so.2)
         libCairo=$out/eclipse/libcairo-swt.so
         patchelf --set-interpreter $interpreter $out/eclipse/eclipse
-        [ -f $libCairo ] && patchelf --set-rpath ${freetype}/lib:${fontconfig}/lib:${libX11}/lib:${libXrender}/lib:${zlib}/lib $libCairo
+        [ -f $libCairo ] && patchelf --set-rpath ${lib.makeLibraryPath [ freetype fontconfig libX11 libXrender zlib ]} "$libCairo"
 
         # Create wrapper script.  Pass -configuration to store
         # settings in ~/.eclipse/org.eclipse.platform_<version> rather
@@ -47,7 +47,7 @@ let
         
         makeWrapper $out/eclipse/eclipse $out/bin/eclipse \
           --prefix PATH : ${jre}/bin \
-          --prefix LD_LIBRARY_PATH : ${glib}/lib:${gtk}/lib:${libXtst}/lib${stdenv.lib.optionalString (webkitgtk2 != null) ":${webkitgtk2}/lib"} \
+          --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath ([ glib gtk libXtst ] ++ lib.optional (webkitgtk2 != null) webkitgtk2)} \
           --add-flags "-configuration \$HOME/.eclipse/''${productId}_$productVersion/configuration"
 
         # Create desktop item.
diff --git a/pkgs/applications/editors/edbrowse/default.nix b/pkgs/applications/editors/edbrowse/default.nix
index d969552ecde..712ede2e316 100644
--- a/pkgs/applications/editors/edbrowse/default.nix
+++ b/pkgs/applications/editors/edbrowse/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     substituteInPlace src/ebjs.c --replace \"edbrowse-js\" \"$out/bin/edbrowse-js\"
   '';
 
-  NIX_CFLAGS_COMPILE = "-I${spidermonkey_24}/include/mozjs-24";
+  NIX_CFLAGS_COMPILE = "-I${spidermonkey_24.dev}/include/mozjs-24";
   makeFlags = "-C src prefix=$(out)";
 
   src = fetchurl {
diff --git a/pkgs/applications/editors/emacs-24/default.nix b/pkgs/applications/editors/emacs-24/default.nix
index 59f9f711004..5dd477f2981 100644
--- a/pkgs/applications/editors/emacs-24/default.nix
+++ b/pkgs/applications/editors/emacs-24/default.nix
@@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
              "--with-gif=no" "--with-tiff=no" ];
 
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.isDarwin && withX)
-    "-I${cairo}/include/cairo";
+    "-I${cairo.dev}/include/cairo";
 
   postInstall = ''
     mkdir -p $out/share/emacs/site-lisp/
diff --git a/pkgs/applications/editors/emacs-24/macport-24.3.nix b/pkgs/applications/editors/emacs-24/macport-24.3.nix
index 191969eef5b..edf8a28d6ff 100644
--- a/pkgs/applications/editors/emacs-24/macport-24.3.nix
+++ b/pkgs/applications/editors/emacs-24/macport-24.3.nix
@@ -33,12 +33,12 @@ stdenv.mkDerivation rec {
     # Further, we need to make sure that the -L option occurs before mention
     # of the library, so that it finds it within the Nix store.
     sed -i 's/tinfo ncurses/tinfo ncursesw/' configure
-    ncurseslib=$(echo ${ncurses}/lib | sed 's#/#\\/#g')
+    ncurseslib=$(echo ${ncurses.lib}/lib | sed 's#/#\\/#g')
     sed -i "s/OLIBS=\$LIBS/OLIBS=\"-L$ncurseslib \$LIBS\"/" configure
     sed -i 's/LIBS="\$LIBS_TERMCAP \$LIBS"/LIBS="\$LIBS \$LIBS_TERMCAP"/' configure
 
     configureFlagsArray=(
-      LDFLAGS=-L${ncurses}/lib
+      LDFLAGS=-L${ncurses.lib}/lib
       --with-xml2=yes
       --with-gnutls=yes
       --with-mac
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
     )
     makeFlagsArray=(
       CFLAGS=-O3
-      LDFLAGS="-O3 -L${ncurses}/lib"
+      LDFLAGS="-O3 -L${ncurses.lib}/lib"
     );
   '';
 
diff --git a/pkgs/applications/editors/heme/default.nix b/pkgs/applications/editors/heme/default.nix
index d377e5cb36f..19c4183ea67 100644
--- a/pkgs/applications/editors/heme/default.nix
+++ b/pkgs/applications/editors/heme/default.nix
@@ -10,10 +10,11 @@ stdenv.mkDerivation rec {
   postPatch = ''
     substituteInPlace Makefile \
       --replace "/usr/local" "$out" \
-      --replace "CFLAGS = " "CFLAGS = -I${ncurses}/include " \
-      --replace "LDFLAGS = " "LDFLAGS = -L${ncurses}/lib " \
+      --replace "CFLAGS = " "CFLAGS = -I${ncurses.dev}/include " \
+      --replace "LDFLAGS = " "LDFLAGS = -L${ncurses.lib}/lib " \
       --replace "-lcurses" "-lncurses"
   '';
+  buildInputs = [ ncurses ];
   preBuild = ''
     mkdir -p $out/bin
     mkdir -p $out/man/man1
diff --git a/pkgs/applications/editors/idea/default.nix b/pkgs/applications/editors/idea/default.nix
index 25e8dbedd68..0323baabe49 100644
--- a/pkgs/applications/editors/idea/default.nix
+++ b/pkgs/applications/editors/idea/default.nix
@@ -41,7 +41,7 @@ let
           truncate --size=$size $fname
         }
 
-        interpreter=$(echo ${stdenv.glibc}/lib/ld-linux*.so.2)
+        interpreter=$(echo ${stdenv.glibc.out}/lib/ld-linux*.so.2)
         if [ "${stdenv.system}" == "x86_64-linux" ]; then
           target_size=$(get_file_size bin/fsnotifier64)
           patchelf --set-interpreter "$interpreter" bin/fsnotifier64
diff --git a/pkgs/applications/editors/lighttable/default.nix b/pkgs/applications/editors/lighttable/default.nix
index 6dbeff55063..72ecbbc5983 100644
--- a/pkgs/applications/editors/lighttable/default.nix
+++ b/pkgs/applications/editors/lighttable/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, buildEnv, makeDesktopItem, makeWrapper, zlib, glib, alsaLib
 , dbus, gtk, atk, pango, freetype, fontconfig, libgnome_keyring3, gdk_pixbuf
-, cairo, cups, expat, libgpgerror, nspr, gnome3, nss, xorg, udev
+, cairo, cups, expat, libgpgerror, nspr, gnome3, nss, xorg, libudev
 }:
 
 let
@@ -44,7 +44,7 @@ stdenv.mkDerivation rec {
       --set-rpath ${libPath}:${stdenv.cc.cc}/lib${stdenv.lib.optionalString stdenv.is64bit "64"} \
       $out/LightTable/ltbin
 
-    ln -sf ${udev}/lib/libudev.so.1 $out/LightTable/libudev.so.0
+    ln -sf ${libudev.out}/lib/libudev.so.1 $out/LightTable/libudev.so.0
 
     makeWrapper $out/LightTable/ltbin $out/bin/lighttable \
       --prefix "LD_LIBRARY_PATH" : $out/LightTable
diff --git a/pkgs/applications/editors/music/tuxguitar/default.nix b/pkgs/applications/editors/music/tuxguitar/default.nix
index 768842a3875..65ea62b3368 100644
--- a/pkgs/applications/editors/music/tuxguitar/default.nix
+++ b/pkgs/applications/editors/music/tuxguitar/default.nix
@@ -26,7 +26,7 @@ in stdenv.mkDerivation rec {
 
     wrapProgram $out/bin/tuxguitar \
       --set JAVA "${jdk}/bin/java" \
-      --prefix LD_LIBRARY_PATH : "$out/lib/:${swt}/lib:${alsaLib}/lib" \
+      --prefix LD_LIBRARY_PATH : "$out/lib/:${swt}/lib:${alsaLib.out}/lib" \
       --prefix CLASSPATH : "${swt}/jars/swt.jar:$out/lib/tuxguitar.jar:$out/lib/itext.jar"
   '';
 
diff --git a/pkgs/applications/graphics/darktable/default.nix b/pkgs/applications/graphics/darktable/default.nix
index 1cf24e109dd..7d5d4cc7acb 100644
--- a/pkgs/applications/graphics/darktable/default.nix
+++ b/pkgs/applications/graphics/darktable/default.nix
@@ -26,21 +26,21 @@ stdenv.mkDerivation rec {
     ];
 
   preConfigure = ''
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk}/include/gtk-2.0"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk}/lib/gtk-2.0/include"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${cairo}/include/cairo"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${atk}/include/atk-1.0"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk.dev}/include/gtk-2.0"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk.out}/lib/gtk-2.0/include"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${cairo.dev}/include/cairo"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${atk.dev}/include/atk-1.0"
     export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${ilmbase}/include/OpenEXR"
     export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${openexr}/include/OpenEXR"
   '';
 
   cmakeFlags = [
-    "-DPTHREAD_INCLUDE_DIR=${stdenv.glibc}/include"
-    "-DPTHREAD_LIBRARY=${stdenv.glibc}/lib/libpthread.so"
+    "-DPTHREAD_INCLUDE_DIR=${stdenv.glibc.dev}/include"
+    "-DPTHREAD_LIBRARY=${stdenv.glibc.out}/lib/libpthread.so"
     "-DCMAKE_BUILD_TYPE=Release"
     "-DBINARY_PACKAGE_BUILD=1"
-    "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib}/lib/glib-2.0/include"
-    "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk}/lib/gtk-2.0/include"
+    "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
+    "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk.out}/lib/gtk-2.0/include"
     "-DBUILD_USERMANUAL=False"
   ];
 
diff --git a/pkgs/applications/graphics/feh/default.nix b/pkgs/applications/graphics/feh/default.nix
index 8602a9a04f8..39132bb9b6f 100644
--- a/pkgs/applications/graphics/feh/default.nix
+++ b/pkgs/applications/graphics/feh/default.nix
@@ -9,6 +9,8 @@ stdenv.mkDerivation rec {
     sha256 = "0j5wxpqccnd0hl74z2vwv25n7qnik1n2mcm2jn0c0z7cjn4wsa9q";
   };
 
+  outputs = [ "out" "doc" ];
+
   nativeBuildInputs = [ makeWrapper ];
   buildInputs = [ xlibsWrapper imlib2 libjpeg libpng libXinerama curl libexif ];
 
@@ -17,7 +19,7 @@ stdenv.mkDerivation rec {
   '';
 
   postInstall = ''
-    wrapProgram "$out/bin/feh" --prefix PATH : "${libjpeg}/bin" \
+    wrapProgram "$out/bin/feh" --prefix PATH : "${libjpeg.bin}/bin" \
                                --add-flags '--theme=feh'
   '';
 
diff --git a/pkgs/applications/graphics/seg3d/default.nix b/pkgs/applications/graphics/seg3d/default.nix
index 23a2d23b1ae..d645a15b02e 100644
--- a/pkgs/applications/graphics/seg3d/default.nix
+++ b/pkgs/applications/graphics/seg3d/default.nix
@@ -13,8 +13,8 @@ stdenv.mkDerivation {
   patches = [ ./cstdio.patch ];
 
   cmakeFlags = [
-    "-DM_LIBRARY=${stdenv.glibc}/lib/libm.so"
-    "-DDL_LIBRARY=${stdenv.glibc}/lib/libdl.so"
+    "-DM_LIBRARY=${stdenv.glibc.out}/lib/libm.so"
+    "-DDL_LIBRARY=${stdenv.glibc.out}/lib/libdl.so"
     "-DBUILD_UTILS=1"
     "-DBUILD_SEG3D=1"
     "-DBUILD_DATAFLOW=0"
diff --git a/pkgs/applications/graphics/shotwell/default.nix b/pkgs/applications/graphics/shotwell/default.nix
index 052ba9402be..cbb72471de5 100644
--- a/pkgs/applications/graphics/shotwell/default.nix
+++ b/pkgs/applications/graphics/shotwell/default.nix
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
   preFixup = ''
     wrapProgram "$out/bin/shotwell" \
      --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \
-     --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
+     --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
      --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules"
   '';
 
diff --git a/pkgs/applications/graphics/xfig/default.nix b/pkgs/applications/graphics/xfig/default.nix
index 9e53fe3efe2..ca1d5345fb6 100644
--- a/pkgs/applications/graphics/xfig/default.nix
+++ b/pkgs/applications/graphics/xfig/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation {
 
   nativeBuildInputs = [ imake makeWrapper ];
 
-  NIX_CFLAGS_COMPILE = "-I${libXpm}/include/X11";
+  NIX_CFLAGS_COMPILE = "-I${libXpm.dev}/include/X11";
 
   patches =
     let
diff --git a/pkgs/applications/kde-apps-15.08/kdelibs/default.nix b/pkgs/applications/kde-apps-15.08/kdelibs/default.nix
index 18d51e94d7c..49a8e1a11c3 100644
--- a/pkgs/applications/kde-apps-15.08/kdelibs/default.nix
+++ b/pkgs/applications/kde-apps-15.08/kdelibs/default.nix
@@ -2,7 +2,7 @@
 , docbook_xml_dtd_42, docbook_xsl, flex, giflib, herqq, ilmbase
 , libdbusmenu_qt, libjpeg, libxml2, libxslt, perl, phonon, pkgconfig
 , polkit_qt4, qca2, qt4, shared_desktop_ontologies, shared_mime_info
-, soprano, strigi, udev, xz
+, soprano, strigi, udev, xz, pcre
 , lib
 }:
 
@@ -11,7 +11,7 @@ kdeApp {
 
   buildInputs = [
     attica attr avahi giflib herqq libdbusmenu_qt libjpeg libxml2
-    polkit_qt4 qca2 shared_desktop_ontologies udev xz
+    polkit_qt4 qca2 shared_desktop_ontologies udev xz pcre
   ];
   propagatedBuildInputs = [ qt4 soprano phonon strigi ];
   nativeBuildInputs = [
diff --git a/pkgs/applications/misc/audio/soxr/default.nix b/pkgs/applications/misc/audio/soxr/default.nix
index 135ae47aa84..941e1a393b1 100644
--- a/pkgs/applications/misc/audio/soxr/default.nix
+++ b/pkgs/applications/misc/audio/soxr/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "0xf2w3piwz9gfr1xqyrj4k685q5dy53kq3igv663i4f4y4sg9rjl";
   };
 
+  outputs = [ "out" "doc" ]; # headers are just two and very small
+
   preConfigure = if stdenv.isDarwin then ''
     export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:"`pwd`/build/src
   '' else ''
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index 5ccce783210..6bd176d7357 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -36,8 +36,8 @@ stdenv.mkDerivation rec {
     export POPPLER_LIB_DIR=${poppler_utils}/lib
     export MAGICK_INC=${imagemagick}/include/ImageMagick
     export MAGICK_LIB=${imagemagick}/lib
-    export FC_INC_DIR=${fontconfig}/include/fontconfig
-    export FC_LIB_DIR=${fontconfig}/lib
+    export FC_INC_DIR=${fontconfig.dev}/include/fontconfig
+    export FC_LIB_DIR=${fontconfig.lib}/lib
     export PODOFO_INC_DIR=${podofo}/include/podofo
     export PODOFO_LIB_DIR=${podofo}/lib
     export SIP_BIN=${sip_4_16}/bin/sip
diff --git a/pkgs/applications/misc/djvulibre/default.nix b/pkgs/applications/misc/djvulibre/default.nix
index b0f89cc5ea0..910b24358b4 100644
--- a/pkgs/applications/misc/djvulibre/default.nix
+++ b/pkgs/applications/misc/djvulibre/default.nix
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "0psh3zl9dj4n4r3lx25390nx34xz0bg0ql48zdskhq354ljni5p6";
   };
 
+  outputs = [ "dev" "out" "bin" ];
+
   buildInputs = [ libjpeg libtiff librsvg ] ++ libintlOrEmpty;
 
   NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-lintl";
diff --git a/pkgs/applications/misc/get_iplayer/default.nix b/pkgs/applications/misc/get_iplayer/default.nix
index 08fad5a021d..d3dfd000c10 100644
--- a/pkgs/applications/misc/get_iplayer/default.nix
+++ b/pkgs/applications/misc/get_iplayer/default.nix
@@ -12,7 +12,7 @@ buildPerlPackage {
     mkdir -p $out/bin
     cp get_iplayer $out/bin
     sed -i 's|^update_script|#update_script|' $out/bin/get_iplayer
-    wrapProgram $out/bin/get_iplayer --suffix PATH : ${ffmpeg}/bin:${flvstreamer}/bin:${vlc}/bin:${rtmpdump}/bin --prefix PERL5LIB : $PERL5LIB
+    wrapProgram $out/bin/get_iplayer --suffix PATH : ${ffmpeg.bin}/bin:${flvstreamer}/bin:${vlc}/bin:${rtmpdump}/bin --prefix PERL5LIB : $PERL5LIB
   '';  
   
   src = fetchurl {
diff --git a/pkgs/applications/misc/girara/default.nix b/pkgs/applications/misc/girara/default.nix
index e91e94695f5..7bb5fb7ddcc 100644
--- a/pkgs/applications/misc/girara/default.nix
+++ b/pkgs/applications/misc/girara/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ pkgconfig gtk gettext ];
 
   makeFlags = [ "PREFIX=$(out)" ]
-    ++ optional withBuildColors "TPUT=${ncurses}/bin/tput"
+    ++ optional withBuildColors "TPUT=${ncurses.dev}/bin/tput"
     ++ optional (!withBuildColors) "TPUT_AVAILABLE=0"
     ;
 
diff --git a/pkgs/applications/misc/ikiwiki/default.nix b/pkgs/applications/misc/ikiwiki/default.nix
index 1f78355ca3a..3e35b7bde4b 100644
--- a/pkgs/applications/misc/ikiwiki/default.nix
+++ b/pkgs/applications/misc/ikiwiki/default.nix
@@ -66,7 +66,7 @@ stdenv.mkDerivation {
       ${lib.optionalString bazaarSupport ''--prefix PATH : ${bazaar}/bin \''}
       ${lib.optionalString cvsSupport ''--prefix PATH : ${cvs}/bin \''}
       ${lib.optionalString cvsSupport ''--prefix PATH : ${cvsps}/bin \''}
-      ${lib.optionalString subversionSupport ''--prefix PATH : ${subversion}/bin \''}
+      ${lib.optionalString subversionSupport ''--prefix PATH : ${subversion.out}/bin \''}
       ${lib.optionalString mercurialSupport ''--prefix PATH : ${mercurial}/bin \''}
       ${lib.concatMapStrings (x: "--prefix PATH : ${x}/bin ") extraUtils}
     done
diff --git a/pkgs/applications/misc/mysql-workbench/default.nix b/pkgs/applications/misc/mysql-workbench/default.nix
index eddf9b8ac71..d9ce635f80b 100644
--- a/pkgs/applications/misc/mysql-workbench/default.nix
+++ b/pkgs/applications/misc/mysql-workbench/default.nix
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     mysql.lib paramiko pcre pexpect pkgconfig pycrypto python sqlite ];
 
   preConfigure = ''
-    substituteInPlace $(pwd)/frontend/linux/workbench/mysql-workbench.in --replace "catchsegv" "${glibc}/bin/catchsegv"
+    substituteInPlace $(pwd)/frontend/linux/workbench/mysql-workbench.in --replace "catchsegv" "${glibc.bin}/bin/catchsegv"
   '';
 
   postConfigure = ''
diff --git a/pkgs/applications/misc/pinfo/default.nix b/pkgs/applications/misc/pinfo/default.nix
index 658ff410d37..222dddc0e89 100644
--- a/pkgs/applications/misc/pinfo/default.nix
+++ b/pkgs/applications/misc/pinfo/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ autoreconfHook gettext texinfo ncurses readline ];
 
-  configureFlags = [ "--with-curses=${ncurses}" "--with-readline=${readline}" ];
+  configureFlags = [ "--with-curses=${ncurses.dev}" "--with-readline=${readline}" ];
 
   meta = with stdenv.lib; {
     description = "A viewer for info files";
diff --git a/pkgs/applications/misc/roxterm/default.nix b/pkgs/applications/misc/roxterm/default.nix
index 60322c2b911..096ee9381c7 100644
--- a/pkgs/applications/misc/roxterm/default.nix
+++ b/pkgs/applications/misc/roxterm/default.nix
@@ -24,9 +24,9 @@ in stdenv.mkDerivation rec {
   propagatedBuildInputs =
     [ dbus_libs dbus_glib gdk_pixbuf gettext gsettings_desktop_schemas gtk2 gtk3 hicolor_icon_theme vte ];
 
-  NIX_CFLAGS_COMPILE = [ "-I${dbus_glib}/include/dbus-1.0"
-                         "-I${dbus_libs}/include/dbus-1.0"
-                         "-I${dbus_libs}/lib/dbus-1.0/include" ];
+  NIX_CFLAGS_COMPILE = [ "-I${dbus_glib.dev}/include/dbus-1.0"
+                         "-I${dbus_libs.dev}/include/dbus-1.0"
+                         "-I${dbus_libs.lib}/lib/dbus-1.0/include" ];
 
   # Fix up python path so the lockfile library is on it.
   PYTHONPATH = stdenv.lib.makeSearchPath "lib/${pythonFull.libPrefix}/site-packages" [
@@ -35,7 +35,7 @@ in stdenv.mkDerivation rec {
 
   buildPhase = ''
     # Fix up the LD_LIBRARY_PATH so that expat is on it
-    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${expat}/lib"
+    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${expat.out}/lib"
 
     python mscript.py configure --prefix="$out"
     python mscript.py build
diff --git a/pkgs/applications/misc/surf/default.nix b/pkgs/applications/misc/surf/default.nix
index 983fbde0c45..089bc1b23db 100644
--- a/pkgs/applications/misc/surf/default.nix
+++ b/pkgs/applications/misc/surf/default.nix
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
 
   preFixup = ''
     wrapProgram "$out/bin/surf" \
-      --prefix GIO_EXTRA_MODULES : ${glib_networking}/lib/gio/modules \
+      --prefix GIO_EXTRA_MODULES : ${glib_networking.out}/lib/gio/modules \
       --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
   '';
 
diff --git a/pkgs/applications/misc/sweethome3d/default.nix b/pkgs/applications/misc/sweethome3d/default.nix
index 0c9b6e8c08a..f55d8ed34ee 100644
--- a/pkgs/applications/misc/sweethome3d/default.nix
+++ b/pkgs/applications/misc/sweethome3d/default.nix
@@ -31,7 +31,7 @@ let
       cp install/${module}-${version}.jar $out/share/java/.
       cp "${sweethome3dItem}/share/applications/"* $out/share/applications
       makeWrapper ${jre}/bin/java $out/bin/$exec \
-        --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3}/share:${gsettings_desktop_schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
+        --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings_desktop_schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
         --add-flags "-jar $out/share/java/${module}-${version}.jar -cp $out/share/java/Furniture.jar:$out/share/java/Textures.jar:$out/share/java/Help.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}"
     '';
 
diff --git a/pkgs/applications/misc/sweethome3d/editors.nix b/pkgs/applications/misc/sweethome3d/editors.nix
index 87da1c6643b..204e5eeae59 100644
--- a/pkgs/applications/misc/sweethome3d/editors.nix
+++ b/pkgs/applications/misc/sweethome3d/editors.nix
@@ -40,7 +40,7 @@ let
       cp ${module}-${version}.jar $out/share/java/.
       cp "${editorItem}/share/applications/"* $out/share/applications
       makeWrapper ${jre}/bin/java $out/bin/$exec \
-        --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3}/share:${gsettings_desktop_schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
+        --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gtk3.out}/share:${gsettings_desktop_schemas}/share:$out/share:$GSETTINGS_SCHEMAS_PATH" \
         --add-flags "-jar $out/share/java/${module}-${version}.jar ${if stdenv.system == "x86_64-linux" then "-d64" else "-d32"}"
     '';
 
diff --git a/pkgs/applications/misc/tilda/default.nix b/pkgs/applications/misc/tilda/default.nix
index bf99f0f5f65..43b7312cda6 100644
--- a/pkgs/applications/misc/tilda/default.nix
+++ b/pkgs/applications/misc/tilda/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ pkgconfig autoreconfHook gettext confuse vte gtk makeWrapper ];
 
-  LD_LIBRARY_PATH = "${expat}/lib"; # ugly hack for xgettext to work during build
+  LD_LIBRARY_PATH = "${expat.out}/lib"; # ugly hack for xgettext to work during build
 
   # The config locking scheme relies on the binary being called "tilda",
   # (`pgrep -C tilda`), so a simple `wrapProgram` won't suffice:
diff --git a/pkgs/applications/misc/xca/default.nix b/pkgs/applications/misc/xca/default.nix
index 76de3627630..64b9009f152 100644
--- a/pkgs/applications/misc/xca/default.nix
+++ b/pkgs/applications/misc/xca/default.nix
@@ -11,7 +11,8 @@ stdenv.mkDerivation rec {
 
   postInstall = ''
     wrapProgram "$out/bin/xca" \
-      --prefix LD_LIBRARY_PATH : "${qt4}/lib:${gcc.cc}/lib:${gcc.cc}/lib64:${openssl}/lib:${libtool}/lib"
+      --prefix LD_LIBRARY_PATH : \
+        "${gcc.cc.lib}/lib64:${stdenv.lib.makeLibraryPath [ qt4 gcc.cc openssl libtool ]}"
   '';
 
   buildInputs = [ openssl qt4 libtool gcc makeWrapper ];
diff --git a/pkgs/applications/misc/xneur/default.nix b/pkgs/applications/misc/xneur/default.nix
index cc08436fa03..8e3165b75d2 100644
--- a/pkgs/applications/misc/xneur/default.nix
+++ b/pkgs/applications/misc/xneur/default.nix
@@ -23,13 +23,13 @@ stdenv.mkDerivation rec {
     sed -e 's@for imlib2_dir in@for imlib2_dir in ${imlib2} @' -i configure
     sed -e 's@for xosd_dir in@for xosd_dir in ${xosd} @' -i configure
 
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk}/include/gtk-2.0"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk}/lib/gtk-2.0/include"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${cairo}/include/cairo"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${pango}/include/pango-1.0"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${atk}/include/atk-1.0"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gdk_pixbuf}/include/gdk-pixbuf-2.0"
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gdk_pixbuf}/lib/gdk-pixbuf-2.0/include"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk.dev}/include/gtk-2.0"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gtk.out}/lib/gtk-2.0/include"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${cairo.dev}/include/cairo"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${pango.dev}/include/pango-1.0"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${atk.dev}/include/atk-1.0"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gdk_pixbuf.dev}/include/gdk-pixbuf-2.0"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${gdk_pixbuf.out}/lib/gdk-pixbuf-2.0/include"
 
     export NIX_LDFLAGS="$NIX_LDFLAGS -lnotify"
   '';
diff --git a/pkgs/applications/misc/zathura/core/default.nix b/pkgs/applications/misc/zathura/core/default.nix
index cab6423b77e..92892b54845 100644
--- a/pkgs/applications/misc/zathura/core/default.nix
+++ b/pkgs/applications/misc/zathura/core/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
     "PREFIX=$(out)"
     "RSTTOMAN=${docutils}/bin/rst2man.py"
     "VERBOSE=1"
-    "TPUT=${ncurses}/bin/tput"
+    "TPUT=${ncurses.dev}/bin/tput"
   ];
 
   postInstall = ''
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index 0490afc04bc..943c87bd0a3 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -8,7 +8,7 @@
 , libusb1, libexif, pciutils
 
 , python, pythonPackages, perl, pkgconfig
-, nspr, udev, kerberos
+, nspr, libudev, kerberos
 , utillinux, alsaLib
 , bison, gperf
 , glib, gtk, dbus_glib
@@ -107,7 +107,7 @@ let
     buildInputs = defaultDependencies ++ [
       which
       python perl pkgconfig
-      nspr udev
+      nspr libudev
       (if useOpenSSL then openssl else nss)
       utillinux alsaLib
       bison gperf kerberos
@@ -135,7 +135,7 @@ let
         s|= [^;]*|= base::FilePath().AppendASCII("${libexif}/lib/libexif.so")|
       }' chrome/utility/media_galleries/image_metadata_extractor.cc
 
-      sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${udev}/lib/\1!' \
+      sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${libudev.out}/lib/\1!' \
         device/udev_linux/udev?_loader.cc
 
       sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
diff --git a/pkgs/applications/networking/browsers/dwb/default.nix b/pkgs/applications/networking/browsers/dwb/default.nix
index d79a5215ce2..8a8478d3867 100644
--- a/pkgs/applications/networking/browsers/dwb/default.nix
+++ b/pkgs/applications/networking/browsers/dwb/default.nix
@@ -18,10 +18,10 @@ stdenv.mkDerivation {
 
   preFixup=''
     wrapProgram "$out/bin/dwb" \
-     --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules:${dconf}/lib/gio/modules" \
+     --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules:${dconf}/lib/gio/modules" \
      --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share"
     wrapProgram "$out/bin/dwbem" \
-     --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules"
+     --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/browsers/jumanji/default.nix b/pkgs/applications/networking/browsers/jumanji/default.nix
index 1969a1f502f..3555a712cc3 100644
--- a/pkgs/applications/networking/browsers/jumanji/default.nix
+++ b/pkgs/applications/networking/browsers/jumanji/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   preFixup=''
     wrapProgram "$out/bin/jumanji" \
-     --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+     --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules" \
      --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
   '';
 
diff --git a/pkgs/applications/networking/browsers/luakit/default.nix b/pkgs/applications/networking/browsers/luakit/default.nix
index a3edaad37d4..2777cb15fca 100644
--- a/pkgs/applications/networking/browsers/luakit/default.nix
+++ b/pkgs/applications/networking/browsers/luakit/default.nix
@@ -45,7 +45,7 @@ stdenv.mkDerivation {
   in ''
     make DEVELOPMENT_PATHS=0 INSTALLDIR=$out DESTDIR=$out PREFIX=$out USE_GTK3=1 install
     wrapProgram $out/bin/luakit                                         \
-      --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+      --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules" \
       --prefix XDG_DATA_DIRS : "${gsettings_desktop_schemas}/share:$out/usr/share/:$out/share/:$GSETTINGS_SCHEMAS_PATH"     \
       --prefix XDG_CONFIG_DIRS : "$out/etc/xdg"                         \
       --set LUA_PATH '"${luaKitPath};${luaPath};"'                      \
diff --git a/pkgs/applications/networking/browsers/midori/default.nix b/pkgs/applications/networking/browsers/midori/default.nix
index 5cdfcf5e975..d5e73c3be7d 100644
--- a/pkgs/applications/networking/browsers/midori/default.nix
+++ b/pkgs/applications/networking/browsers/midori/default.nix
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
 
   preFixup = ''
     wrapProgram $out/bin/midori \
-      --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+      --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules" \
       --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
   '';
 }
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/gecko-mediaplayer/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/gecko-mediaplayer/default.nix
index ba40925e1d1..f59de7db9f5 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/gecko-mediaplayer/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/gecko-mediaplayer/default.nix
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   # !!! fix this
   preBuild =
     ''
-      export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${browser}/include/xulrunner-*) -I${browser.nspr}/include/nspr"
+      export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$(echo ${browser}/include/xulrunner-*) -I${browser.nspr.dev}/include/nspr"
       echo $NIX_CFLAGS_COMPILE
     '';
 
diff --git a/pkgs/applications/networking/browsers/uzbl/default.nix b/pkgs/applications/networking/browsers/uzbl/default.nix
index 318b9576392..1a46b1adce8 100644
--- a/pkgs/applications/networking/browsers/uzbl/default.nix
+++ b/pkgs/applications/networking/browsers/uzbl/default.nix
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
   preFixup = ''
     for f in $out/bin/*; do
       wrapProgram $f \
-        --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+        --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules" \
         --prefix PYTHONPATH : "$PYTHONPATH" \
         --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share"
     done
diff --git a/pkgs/applications/networking/browsers/vimb/default.nix b/pkgs/applications/networking/browsers/vimb/default.nix
index 84a2870b6d0..d67c8abf456 100644
--- a/pkgs/applications/networking/browsers/vimb/default.nix
+++ b/pkgs/applications/networking/browsers/vimb/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   preFixup = ''
     wrapProgram "$out/bin/vimb" \
-      --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+      --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules" \
       --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
   '';
 
diff --git a/pkgs/applications/networking/browsers/vimprobable2/default.nix b/pkgs/applications/networking/browsers/vimprobable2/default.nix
index 6f8eede9b3f..45aa2a9c2d1 100644
--- a/pkgs/applications/networking/browsers/vimprobable2/default.nix
+++ b/pkgs/applications/networking/browsers/vimprobable2/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   preFixup = ''
     wrapProgram "$out/bin/vimprobable2" \
-      --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+      --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules" \
       --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH"
   '';
 
diff --git a/pkgs/applications/networking/copy-com/default.nix b/pkgs/applications/networking/copy-com/default.nix
index 968218309ed..c9fecd9daed 100644
--- a/pkgs/applications/networking/copy-com/default.nix
+++ b/pkgs/applications/networking/copy-com/default.nix
@@ -41,7 +41,7 @@ in stdenv.mkDerivation {
     for binary in Copy{Agent,Console,Cmd}; do
       binary="$out/${appdir}/$binary"
       ln -sv "$binary" "$out/bin"
-      patchelf --set-interpreter ${stdenv.glibc}/lib/${interpreter} "$binary"
+      patchelf --set-interpreter ${stdenv.glibc.out}/lib/${interpreter} "$binary"
     done
 
     # Older versions of this package happily installed broken copies of
diff --git a/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix b/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix
index a254535dd70..99196cdf796 100644
--- a/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix
+++ b/pkgs/applications/networking/feedreaders/newsbeuter/dev.nix
@@ -23,7 +23,7 @@ stdenv.mkDerivation rec {
   '';
 
   NIX_CFLAGS_COMPILE =
-    "-I${libxml2}/include/libxml2 -I${json-c-0-11}/include/json-c";
+    "-I${libxml2.dev}/include/libxml2 -I${json-c-0-11}/include/json-c";
 
   NIX_LDFLAGS = "-lsqlite3 -lcurl -lxml2 -lstfl -ljson";
 
diff --git a/pkgs/applications/networking/ike/default.nix b/pkgs/applications/networking/ike/default.nix
index 56341b64d6c..afb8c22272e 100644
--- a/pkgs/applications/networking/ike/default.nix
+++ b/pkgs/applications/networking/ike/default.nix
@@ -33,7 +33,7 @@ stdenv.mkDerivation rec {
   installPhase = ''
     make install
     for file in "$out"/bin/* "$out"/sbin/*; do
-        wrapProgram $file --prefix LD_LIBRARY_PATH ":" "$out/lib:${openssl}/lib:${gcc.cc}/lib:${stdenv.glibc}/lib::${gcc.cc}/lib64:${stdenv.glibc}/lib64:${libedit}/lib:${qt4}/lib"
+        wrapProgram $file --prefix LD_LIBRARY_PATH ":" "$out/lib:${openssl}/lib:${gcc.cc}/lib:${stdenv.glibc.out}/lib::${gcc.cc}/lib64:${stdenv.glibc.out}/lib64:${libedit}/lib:${qt4}/lib"
     done
   '';
 
diff --git a/pkgs/applications/networking/instant-messengers/blink/default.nix b/pkgs/applications/networking/instant-messengers/blink/default.nix
index 7bb14efc1bb..233eb38ae86 100644
--- a/pkgs/applications/networking/instant-messengers/blink/default.nix
+++ b/pkgs/applications/networking/instant-messengers/blink/default.nix
@@ -22,7 +22,7 @@ pythonPackages.buildPythonPackage rec {
 
   postInstall = ''
     wrapProgram $out/bin/blink \
-      --prefix LD_LIBRARY_PATH ":" ${gnutls}/lib
+      --prefix LD_LIBRARY_PATH ":" ${gnutls.out}/lib
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/instant-messengers/carrier/2.5.0.nix b/pkgs/applications/networking/instant-messengers/carrier/2.5.0.nix
index 7368a884214..d29ec7ab8d3 100644
--- a/pkgs/applications/networking/instant-messengers/carrier/2.5.0.nix
+++ b/pkgs/applications/networking/instant-messengers/carrier/2.5.0.nix
@@ -1,4 +1,4 @@
-args @ { fetchurl, stdenv, pkgconfig, perl, perlXMLParser, libxml2, openssl, nss
+args @ { fetchurl, stdenv, pkgconfig, perl, perlXMLParser, libxml2, openssl, nss, nspr
 , gtkspell, aspell, gettext, ncurses, avahi, dbus, dbus_glib, python
 , libtool, automake, autoconf, gstreamer
 , gtk, glib
@@ -19,7 +19,7 @@ rec {
 
   buildInputs = [gtkspell aspell
     gstreamer startupnotification
-    libxml2 openssl nss
+    libxml2 openssl nss nspr
     libXScrnSaver ncurses scrnsaverproto
     libX11 xproto kbproto GConf avahi
     dbus dbus_glib glib python
@@ -29,9 +29,9 @@ rec {
     pkgconfig gtk perl perlXMLParser gettext
   ];
 
-  configureFlags="--with-nspr-includes=${nss}/include/nspr"
-    + " --with-nspr-libs=${nss}/lib --with-nss-includes=${nss}/include/nss"
-    + " --with-nss-libs=${nss}/lib --with-ncurses-headers=${ncurses}/include"
+  configureFlags="--with-nspr-includes=${nspr.dev}/include/nspr"
+    + " --with-nspr-libs=${nspr.out}/lib --with-nss-includes=${nss.dev}/include/nss"
+    + " --with-nss-libs=${nss.out}/lib --with-ncurses-headers=${ncurses.dev}/include"
     + " --enable-screensaver --disable-meanwhile --disable-nm --disable-tcl";
 
   preBuild = fullDepEntry (''
diff --git a/pkgs/applications/networking/instant-messengers/oneteam/default.nix b/pkgs/applications/networking/instant-messengers/oneteam/default.nix
index 2ab0930842b..bec367818e2 100644
--- a/pkgs/applications/networking/instant-messengers/oneteam/default.nix
+++ b/pkgs/applications/networking/instant-messengers/oneteam/default.nix
@@ -43,7 +43,7 @@ rec {
   '' ["minInit" "doUnpack"];
 
   setVars=a.noDepEntry ''
-    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${nspr}/include/nspr"
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${nspr.dev}/include/nspr"
   '';
 
   cmakeBuildDir="cmake-build";
diff --git a/pkgs/applications/networking/instant-messengers/pidgin/default.nix b/pkgs/applications/networking/instant-messengers/pidgin/default.nix
index 5e8f266930f..ebb82a78262 100644
--- a/pkgs/applications/networking/instant-messengers/pidgin/default.nix
+++ b/pkgs/applications/networking/instant-messengers/pidgin/default.nix
@@ -41,11 +41,11 @@ stdenv.mkDerivation rec {
   patches = [./pidgin-makefile.patch ./add-search-path.patch ];
 
   configureFlags = [
-    "--with-nspr-includes=${nspr}/include/nspr"
-    "--with-nspr-libs=${nspr}/lib"
-    "--with-nss-includes=${nss}/include/nss"
-    "--with-nss-libs=${nss}/lib"
-    "--with-ncurses-headers=${ncurses}/include"
+    "--with-nspr-includes=${nspr.dev}/include/nspr"
+    "--with-nspr-libs=${nspr.out}/lib"
+    "--with-nss-includes=${nss.dev}/include/nss"
+    "--with-nss-libs=${nss.out}/lib"
+    "--with-ncurses-headers=${ncurses.dev}/include"
     "--disable-meanwhile"
     "--disable-nm"
     "--disable-tcl"
diff --git a/pkgs/applications/networking/instant-messengers/sflphone/default.nix b/pkgs/applications/networking/instant-messengers/sflphone/default.nix
index 8b259c90fe5..7322ff2bb34 100644
--- a/pkgs/applications/networking/instant-messengers/sflphone/default.nix
+++ b/pkgs/applications/networking/instant-messengers/sflphone/default.nix
@@ -40,7 +40,7 @@ rec {
       cd ..
     '';
 
-    configureFlags = "--with-expat --with-expat-inc=${expat}/include " +
+    configureFlags = "--with-expat --with-expat-inc=${expat.dev}/include " +
       "--with-expat-lib=-lexpat --with-opus ";
 
     buildInputs = [ libyaml alsaLib openssl libuuid pkgconfig libpulseaudio libsamplerate
diff --git a/pkgs/applications/networking/instant-messengers/telepathy/kde/default.nix b/pkgs/applications/networking/instant-messengers/telepathy/kde/default.nix
index 532d68ad660..84ced8f62c6 100644
--- a/pkgs/applications/networking/instant-messengers/telepathy/kde/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telepathy/kde/default.nix
@@ -11,11 +11,11 @@ let
     call_ui = x : x // {
       NIX_CFLAGS_COMPILE =
         "-I${telepathy_glib}/include/telepathy-1.0"
-        + " -I${dbus_glib}/include/dbus-1.0"
-        + " -I${dbus_libs}/include/dbus-1.0";
+        + " -I${dbus_glib.dev}/include/dbus-1.0"
+        + " -I${dbus_libs.dev}/include/dbus-1.0";
     };
     telepathy_logger_qt = x : x // {
-      NIX_CFLAGS_COMPILE = "-I${dbus_libs}/include/dbus-1.0";
+      NIX_CFLAGS_COMPILE = "-I${dbus_libs.dev}/include/dbus-1.0";
     };
   };
 
diff --git a/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix b/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix
index 173dfe9c929..aaff39ccb44 100644
--- a/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telepathy/logger/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "18i00l8lnp5dghqmgmpxnn0is2a20pkisxy0sb78hnd2dz0z6xnl";
   };
 
-  NIX_CFLAGS_COMPILE = "-I${dbus_glib}/include/dbus-1.0 -I${dbus_libs}/include/dbus-1.0";
+  NIX_CFLAGS_COMPILE = "-I${dbus_glib.dev}/include/dbus-1.0 -I${dbus_libs.dev}/include/dbus-1.0";
 
   buildInputs = [ dbus_glib libxml2 sqlite telepathy_glib pkgconfig intltool
                   gobjectIntrospection dbus_libs ];
diff --git a/pkgs/applications/networking/newsreaders/liferea/default.nix b/pkgs/applications/networking/newsreaders/liferea/default.nix
index def45c7e756..f2844edd4f0 100644
--- a/pkgs/applications/networking/newsreaders/liferea/default.nix
+++ b/pkgs/applications/networking/newsreaders/liferea/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
       wrapProgram "$f" \
         --prefix PYTHONPATH : "$(toPythonPath $out):$(toPythonPath ${pygobject3})" \
         --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
-        --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules:${glib_networking}/lib/gio/modules" \
+        --prefix GIO_EXTRA_MODULES : "${gnome3.dconf}/lib/gio/modules:${glib_networking.out}/lib/gio/modules" \
         --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS:${gnome3.gtk}/share:$out/share:$GSETTINGS_SCHEMAS_PATH"
     done
   '';
diff --git a/pkgs/applications/networking/p2p/retroshare/0.6.nix b/pkgs/applications/networking/p2p/retroshare/0.6.nix
index 855ebdd0593..020d0017053 100644
--- a/pkgs/applications/networking/p2p/retroshare/0.6.nix
+++ b/pkgs/applications/networking/p2p/retroshare/0.6.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation {
     sha256 = "189qndkfq9kgv3qi3wx8ivla4j8fxr4iv7c8y9rjrjaz8jwdkn5x";
   };
 
-  NIX_CFLAGS_COMPILE = "-I${glib}/include/glib-2.0 -I${glib}/lib/glib-2.0/include -I${libxml2}/include/libxml2 -I${sqlcipher}/include/sqlcipher";
+  NIX_CFLAGS_COMPILE = "-I${glib.dev}/include/glib-2.0 -I${glib.dev}/lib/glib-2.0/include -I${libxml2.dev}/include/libxml2 -I${sqlcipher}/include/sqlcipher";
 
   patchPhase = ''
     # Fix build error
diff --git a/pkgs/applications/networking/p2p/retroshare/default.nix b/pkgs/applications/networking/p2p/retroshare/default.nix
index a139531b19a..e7fe79d66a5 100644
--- a/pkgs/applications/networking/p2p/retroshare/default.nix
+++ b/pkgs/applications/networking/p2p/retroshare/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
     sha256 = "0l2n4pr1hq66q6qa073hrdx3s3d7iw54z8ay1zy82zhk2rwhsavp";
   };
 
-  NIX_CFLAGS_COMPILE = "-I${glib}/include/glib-2.0 -I${glib}/lib/glib-2.0/include -I${libxml2}/include/libxml2";
+  NIX_CFLAGS_COMPILE = "-I${glib.dev}/include/glib-2.0 -I${glib.dev}/lib/glib-2.0/include -I${libxml2.dev}/include/libxml2";
 
   patchPhase = ''
     sed -i 's/UpnpString_get_String(es_event->PublisherUrl)/es_event->PublisherUrl/' \
diff --git a/pkgs/applications/networking/spideroak/default.nix b/pkgs/applications/networking/spideroak/default.nix
index 525e1547023..fd060ad0880 100644
--- a/pkgs/applications/networking/spideroak/default.nix
+++ b/pkgs/applications/networking/spideroak/default.nix
@@ -41,7 +41,7 @@ in stdenv.mkDerivation {
     mkdir "$out/bin"
     rm "$out/usr/bin/SpiderOakONE"
 
-    patchelf --set-interpreter ${stdenv.glibc}/lib/${interpreter} \
+    patchelf --set-interpreter ${stdenv.glibc.out}/lib/${interpreter} \
       "$out/opt/SpiderOakONE/lib/SpiderOakONE"
 
     RPATH=$out/opt/SpiderOakONE/lib:${ldpath}
diff --git a/pkgs/applications/science/astronomy/celestia/default.nix b/pkgs/applications/science/astronomy/celestia/default.nix
index d4da5c113c9..0213348a593 100644
--- a/pkgs/applications/science/astronomy/celestia/default.nix
+++ b/pkgs/applications/science/astronomy/celestia/default.nix
@@ -60,7 +60,7 @@ stdenv.mkDerivation {
       CPPFLAGS="-DNDEBUG"
       CFLAGS="-O2 -fsigned-char"
       CXXFLAGS="-O2 -fsigned-char"
-      GTK_CFLAGS="-I${gtk2}/include/gtk-2.0 -I${gtk2}/lib/gtk-2.0/include -I${glib}/include/glib-2.0 -I${glib}/lib/glib-2.0/include -I${cairo}/include/cairo -I${pango}/include/pango-1.0 -I${gdk_pixbuf}/include/gdk-pixbuf-2.0 -I${atk}/include/atk-1.0 -I${gtkglext}/include/gtkglext-1.0 -I${gtkglext}/lib/gtkglext-1.0/include"
+      GTK_CFLAGS="-I${gtk2.dev}/include/gtk-2.0 -I${gtk2.out}/lib/gtk-2.0/include -I${glib.dev}/include/glib-2.0 -I${glib.out}/lib/glib-2.0/include -I${cairo.dev}/include/cairo -I${pango.dev}/include/pango-1.0 -I${gdk_pixbuf.dev}/include/gdk-pixbuf-2.0 -I${atk.dev}/include/atk-1.0 -I${gtkglext}/include/gtkglext-1.0 -I${gtkglext}/lib/gtkglext-1.0/include"
       GTK_LIBS="-lgtk-x11-2.0 -lgtkglext-x11-1.0 -lcairo -lgdk_pixbuf-2.0 -lpango-1.0 -lgobject-2.0"
     )
   '';
diff --git a/pkgs/applications/science/electronics/tkgate/1.x.nix b/pkgs/applications/science/electronics/tkgate/1.x.nix
index e9849d0460c..c62ecdcd1e2 100644
--- a/pkgs/applications/science/electronics/tkgate/1.x.nix
+++ b/pkgs/applications/science/electronics/tkgate/1.x.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchurl, tcl, tk, libX11, glibc, which, yacc, flex, imake, xproto, gccmakedep }:
 
 let
-  libiconvInc = stdenv.lib.optionalString stdenv.isLinux "${glibc}/include";
-  libiconvLib = stdenv.lib.optionalString stdenv.isLinux "${glibc}/lib";
+  libiconvInc = stdenv.lib.optionalString stdenv.isLinux "${glibc.dev}/include";
+  libiconvLib = stdenv.lib.optionalString stdenv.isLinux "${glibc.out}/lib";
 in
 stdenv.mkDerivation rec {
   name = "tkgate-1.8.7";
diff --git a/pkgs/applications/science/electronics/tkgate/2.x.nix b/pkgs/applications/science/electronics/tkgate/2.x.nix
index 108986ddefe..166047a9841 100644
--- a/pkgs/applications/science/electronics/tkgate/2.x.nix
+++ b/pkgs/applications/science/electronics/tkgate/2.x.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchurl, tcl, tk, libX11, glibc }:
 
 let
-  libiconvInc = stdenv.lib.optionalString stdenv.isLinux "${glibc}/include";
-  libiconvLib = stdenv.lib.optionalString stdenv.isLinux "${glibc}/lib";
+  libiconvInc = stdenv.lib.optionalString stdenv.isLinux "${glibc.dev}/include";
+  libiconvLib = stdenv.lib.optionalString stdenv.isLinux "${glibc.out}/lib";
 in
 stdenv.mkDerivation rec {
   name = "tkgate-2.0-b10";
diff --git a/pkgs/applications/science/logic/hol/default.nix b/pkgs/applications/science/logic/hol/default.nix
index f8a57aebb6d..c7fb4ffbb97 100644
--- a/pkgs/applications/science/logic/hol/default.nix
+++ b/pkgs/applications/science/logic/hol/default.nix
@@ -32,7 +32,7 @@ stdenv.mkDerivation {
   buildCommand = ''
 
     mkdir chroot-fontconfig
-    cat ${fontconfig}/etc/fonts/fonts.conf > chroot-fontconfig/fonts.conf
+    cat ${fontconfig.out}/etc/fonts/fonts.conf > chroot-fontconfig/fonts.conf
     sed -e 's@</fontconfig>@@' -i chroot-fontconfig/fonts.conf
     echo "<dir>${liberation_ttf}</dir>" >> chroot-fontconfig/fonts.conf
     echo "</fontconfig>" >> chroot-fontconfig/fonts.conf
diff --git a/pkgs/applications/science/logic/saw-tools/default.nix b/pkgs/applications/science/logic/saw-tools/default.nix
index eebe6ff0a06..97a06bf093d 100644
--- a/pkgs/applications/science/logic/saw-tools/default.nix
+++ b/pkgs/applications/science/logic/saw-tools/default.nix
@@ -35,7 +35,7 @@ stdenv.mkDerivation rec {
     mv doc $out/share
 
     # Hack around lack of libtinfo in NixOS
-    ln -s ${ncurses}/lib/libncursesw.so.5       $out/lib/libtinfo.so.5
+    ln -s ${ncurses.lib}/lib/libncursesw.so.5       $out/lib/libtinfo.so.5
     ln -s ${stdenv.cc.libc}/lib/libpthread.so.0 $out/lib/libpthread.so.0
 
     # Add a clang symlink for easy building with a suitable compiler.
diff --git a/pkgs/applications/science/logic/tptp/default.nix b/pkgs/applications/science/logic/tptp/default.nix
index d4c62858753..f3c0a7917cf 100644
--- a/pkgs/applications/science/logic/tptp/default.nix
+++ b/pkgs/applications/science/logic/tptp/default.nix
@@ -65,7 +65,7 @@ rec {
   '' ["defEnsureDir" "minInit"];
 
   patchBinaries = a.fullDepEntry ''
-    patchelf --set-interpreter "${pkgsi686Linux.glibc}"/lib/ld-linux.so.* \
+    patchelf --set-interpreter "${pkgsi686Linux.glibc.out}"/lib/ld-linux.so.* \
       "Scripts/tptp4X"
   '' ["addInputs"];
       
diff --git a/pkgs/applications/science/logic/yices/default.nix b/pkgs/applications/science/logic/yices/default.nix
index 5daaa444c12..f495ee257ff 100644
--- a/pkgs/applications/science/logic/yices/default.nix
+++ b/pkgs/applications/science/logic/yices/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp, gperf, autoreconfHook }:
+{ stdenv, fetchurl, gmp-static, gperf, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name    = "yices-${version}";
@@ -10,10 +10,10 @@ stdenv.mkDerivation rec {
     sha256 = "1da70n0cah0dh3pk7fcrvjkszx9qmhc0csgl15jqa7bdh707k2zs";
   };
 
-  configureFlags = [ "--with-static-gmp=${gmp}/lib/libgmp.a"
-                     "--with-static-gmp-include-dir=${gmp}/include"
+  configureFlags = [ "--with-static-gmp=${gmp-static.out}/lib/libgmp.a"
+                     "--with-static-gmp-include-dir=${gmp-static.dev}/include"
                    ];
-  buildInputs = [ gmp gperf autoreconfHook ];
+  buildInputs = [ gmp-static gperf autoreconfHook ];
 
   meta = {
     description = "A high-performance theorem prover and SMT solver";
diff --git a/pkgs/applications/search/recoll/default.nix b/pkgs/applications/search/recoll/default.nix
index 555da3de6d5..631555234ce 100644
--- a/pkgs/applications/search/recoll/default.nix
+++ b/pkgs/applications/search/recoll/default.nix
@@ -27,12 +27,12 @@ stdenv.mkDerivation rec {
       substituteInPlace  $f --replace antiword      ${antiword}/bin/antiword
       substituteInPlace  $f --replace awk           ${gawk}/bin/awk
       substituteInPlace  $f --replace catppt        ${catdoc}/bin/catppt
-      substituteInPlace  $f --replace djvused       ${djvulibre}/bin/djvused
-      substituteInPlace  $f --replace djvutxt       ${djvulibre}/bin/djvutxt
+      substituteInPlace  $f --replace djvused       ${djvulibre.bin}/bin/djvused
+      substituteInPlace  $f --replace djvutxt       ${djvulibre.bin}/bin/djvutxt
       substituteInPlace  $f --replace grep          ${gnugrep}/bin/grep
       substituteInPlace  $f --replace groff         ${groff}/bin/groff
       substituteInPlace  $f --replace gunzip        ${gzip}/bin/gunzip
-      substituteInPlace  $f --replace iconv         ${libiconv}/bin/iconv
+      substituteInPlace  $f --replace iconv         ${libiconv.bin}/bin/iconv
       substituteInPlace  $f --replace lyx           ${lyx}/bin/lyx
       substituteInPlace  $f --replace pdftotext     ${poppler_utils}/bin/pdftotext
       substituteInPlace  $f --replace pstotext      ${ghostscript}/bin/ps2ascii 
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
       substituteInPlace  $f --replace tar           ${gnutar}/bin/tar
       substituteInPlace  $f --replace unzip         ${unzip}/bin/unzip
       substituteInPlace  $f --replace xls2csv       ${catdoc}/bin/xls2csv
-      substituteInPlace  $f --replace xsltproc      ${libxslt}/bin/xsltproc
+      substituteInPlace  $f --replace xsltproc      ${libxslt.bin}/bin/xsltproc
       substituteInPlace  $f --replace unrtf         ${unrtf}/bin/unrtf
       substituteInPlace  $f --replace untex         ${untex}/bin/untex
       substituteInPlace  $f --replace wpd2html      ${libwpd}/bin/wpd2html
diff --git a/pkgs/applications/version-management/git-and-tools/svn2git-kde/default.nix b/pkgs/applications/version-management/git-and-tools/svn2git-kde/default.nix
index 91fe1662efe..f282fa6635b 100644
--- a/pkgs/applications/version-management/git-and-tools/svn2git-kde/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/svn2git-kde/default.nix
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   buildPhase = ''
     sed -i 's|/bin/cat|cat|' ./src/repository.cpp
     qmake
-    make CXXFLAGS='-I${apr}/include/apr-1 -I${subversion}/include/subversion-1 -DVER="\"${src.rev}\""'
+    make CXXFLAGS='-I${apr}/include/apr-1 -I${subversion.dev}/include/subversion-1 -DVER="\"${src.rev}\""'
   '';
 
   installPhase = ''
diff --git a/pkgs/applications/version-management/rabbitvcs/default.nix b/pkgs/applications/version-management/rabbitvcs/default.nix
index 100e854f29b..9f817a397f0 100644
--- a/pkgs/applications/version-management/rabbitvcs/default.nix
+++ b/pkgs/applications/version-management/rabbitvcs/default.nix
@@ -17,7 +17,7 @@ python2Packages.buildPythonPackage rec {
       sed -ie 's|if sys\.argv\[1\] == "install":|if False:|' ./setup.py
       sed -ie "s|PREFIX = sys.prefix|PREFIX = \"$out\"|" ./setup.py
       sed -ie 's|/usr/bin/meld|${meld}/bin/meld|' ./rabbitvcs/util/configspec/configspec.ini
-      sed -ie 's|/usr/bin/svnadmin|${subversion}/bin/svnadmin|' ./rabbitvcs/ui/create.py
+      sed -ie 's|/usr/bin/svnadmin|${subversion.out}/bin/svnadmin|' ./rabbitvcs/ui/create.py
       sed -ie "s|/usr/share/doc|$out/share/doc|" ./rabbitvcs/ui/about.py
       sed -ie "s|gnome-open|xdg-open|" ./rabbitvcs/util/helper.py
     '';
diff --git a/pkgs/applications/version-management/rapidsvn/default.nix b/pkgs/applications/version-management/rapidsvn/default.nix
index 843fe9ad323..9397aa8a1e1 100644
--- a/pkgs/applications/version-management/rapidsvn/default.nix
+++ b/pkgs/applications/version-management/rapidsvn/default.nix
@@ -10,8 +10,8 @@ stdenv.mkDerivation {
 
   buildInputs = [ wxGTK subversion apr aprutil python ];
 
-  configureFlags = [ "--with-svn-include=${subversion}/include" 
-    "--with-svn-lib=${subversion}/lib" ];
+  configureFlags = [ "--with-svn-include=${subversion.dev}/include"
+    "--with-svn-lib=${subversion.out}/lib" ];
 
   meta = {
     description = "Multi-platform GUI front-end for the Subversion revision system";
diff --git a/pkgs/applications/version-management/redmine/bootstrap.nix b/pkgs/applications/version-management/redmine/bootstrap.nix
index 5971f2e9cdd..82643f18a55 100644
--- a/pkgs/applications/version-management/redmine/bootstrap.nix
+++ b/pkgs/applications/version-management/redmine/bootstrap.nix
@@ -32,8 +32,8 @@ in stdenv.mkDerivation rec {
 
     bundle config --local build.nokogiri --use-system-libraries \
       --with-iconv-dir=${libiconv} \
-      --with-xslt-dir=${libxslt} \
-      --with-xml2-dir=${libxml2} \
+      --with-xslt-dir=${libxslt.out} \
+      --with-xml2-dir=${libxml2.out} \
       --with-pkg-config \
       --with-pg-config=${postgresql}/bin/pg_config
 
diff --git a/pkgs/applications/version-management/subversion/default.nix b/pkgs/applications/version-management/subversion/default.nix
index f563bebd9db..30af36b4880 100644
--- a/pkgs/applications/version-management/subversion/default.nix
+++ b/pkgs/applications/version-management/subversion/default.nix
@@ -38,6 +38,9 @@ stdenv.mkDerivation (rec {
     inherit (config.${branch}) sha1;
   };
 
+  # Can't do separate $lib and $bin, as libs reference bins
+  outputs = [ "dev" "out" "man" ];
+
   buildInputs = [ zlib apr aprutil sqlite ]
     ++ stdenv.lib.optional httpSupport serf
     ++ stdenv.lib.optional pythonBindings python
@@ -77,6 +80,12 @@ stdenv.mkDerivation (rec {
 
     mkdir -p $out/share/bash-completion/completions
     cp tools/client-side/bash_completion $out/share/bash-completion/completions/subversion
+
+    for f in $out/lib/*.la; do
+      substituteInPlace $f --replace "${expat.dev}/lib" "${expat.out}/lib"
+      substituteInPlace $f --replace "${zlib.dev}/lib" "${zlib.out}/lib"
+      substituteInPlace $f --replace "${sqlite.dev}/lib" "${sqlite.out}/lib"
+    done
   '';
 
   inherit perlBindings pythonBindings;
diff --git a/pkgs/applications/video/avidemux/default.nix b/pkgs/applications/video/avidemux/default.nix
index 89773be9ada..e2aaf30d0c3 100644
--- a/pkgs/applications/video/avidemux/default.nix
+++ b/pkgs/applications/video/avidemux/default.nix
@@ -19,9 +19,9 @@ stdenv.mkDerivation {
     lame faad2 libvorbis yasm libvpx xvidcore libva
   ] ++ stdenv.lib.optional faacSupport faac;
 
-  cmakeFlags = "-DPTHREAD_INCLUDE_DIR=${stdenv.glibc}/include" +
+  cmakeFlags = "-DPTHREAD_INCLUDE_DIR=${stdenv.glibc.dev}/include" +
     " -DGETTEXT_INCLUDE_DIR=${gettext}/include" +
-    " -DSDL_INCLUDE_DIR=${SDL}/include/SDL";
+    " -DSDL_INCLUDE_DIR=${SDL.dev}/include/SDL";
 
   NIX_LDFLAGS="-lpthread";
 
diff --git a/pkgs/applications/video/clipgrab/default.nix b/pkgs/applications/video/clipgrab/default.nix
index 7d136de779a..5bd2087b345 100644
--- a/pkgs/applications/video/clipgrab/default.nix
+++ b/pkgs/applications/video/clipgrab/default.nix
@@ -28,8 +28,8 @@ stdenv.mkDerivation rec {
 
   postPatch = stdenv.lib.optionalString (ffmpeg != null) ''
   substituteInPlace converter_ffmpeg.cpp \
-    --replace '"ffmpeg"' '"${ffmpeg}/bin/ffmpeg"' \
-    --replace '"ffmpeg ' '"${ffmpeg}/bin/ffmpeg '
+    --replace '"ffmpeg"' '"${ffmpeg.bin}/bin/ffmpeg"' \
+    --replace '"ffmpeg ' '"${ffmpeg.bin}/bin/ffmpeg '
   '';
 
   configurePhase = ''
diff --git a/pkgs/applications/video/dvd-slideshow/default.nix b/pkgs/applications/video/dvd-slideshow/default.nix
index a6197c2e6e1..96de3412ea0 100644
--- a/pkgs/applications/video/dvd-slideshow/default.nix
+++ b/pkgs/applications/video/dvd-slideshow/default.nix
@@ -4,7 +4,7 @@ let
   wrapper = writeScript "dvd-slideshow.sh" ''
       #!/bin/bash
       # wrapper script for dvd-slideshow programs
-      export PATH=${cdrtools}/bin:${dvdauthor}/bin:${ffmpeg}/bin:${imagemagick}/bin:${lame}/bin:${mjpegtools}/bin:${sox}/bin:${transcode}/bin:${vorbisTools}/bin:$PATH
+      export PATH=${cdrtools}/bin:${dvdauthor}/bin:${ffmpeg.bin}/bin:${imagemagick}/bin:${lame}/bin:${mjpegtools}/bin:${sox}/bin:${transcode}/bin:${vorbisTools}/bin:$PATH
 
       dir=`dirname "$0"`
       exe=`basename "$0"`
diff --git a/pkgs/applications/video/gnash/default.nix b/pkgs/applications/video/gnash/default.nix
index f53ce93328b..0200b0c70f4 100644
--- a/pkgs/applications/video/gnash/default.nix
+++ b/pkgs/applications/video/gnash/default.nix
@@ -34,7 +34,7 @@ stdenv.mkDerivation rec {
     for lib in $libs; do
       echo -n "$lib " >> macros/libslist
     done
-    echo -n "${stdenv.glibc}/lib" >> macros/libslist
+    echo -n "${stdenv.glibc.out}/lib" >> macros/libslist
 
     # Make sure to honor $TMPDIR, for chroot builds.
     for file in configure gui/Makefile.in Makefile.in
@@ -65,7 +65,7 @@ stdenv.mkDerivation rec {
 
   preConfigure =
     '' configureFlags="                                         \
-         --with-sdl-incl=${SDL}/include/SDL                     \
+         --with-sdl-incl=${SDL.dev}/include/SDL                     \
          --with-npapi-plugindir=$out/plugins                    \
          --enable-media=gst                                     \
          --without-gconf
diff --git a/pkgs/applications/video/kazam/default.nix b/pkgs/applications/video/kazam/default.nix
index 17bf282a459..1e3f5d57a06 100644
--- a/pkgs/applications/video/kazam/default.nix
+++ b/pkgs/applications/video/kazam/default.nix
@@ -34,9 +34,9 @@ python3Packages.buildPythonPackage rec {
   preFixup = ''
     wrapProgram $out/bin/kazam \
       --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
-      --prefix LD_LIBRARY_PATH ":" "${gtk3}/lib:${gst_all_1.gstreamer}/lib:${keybinder}/lib" \
+      --prefix LD_LIBRARY_PATH ":" "${gtk3.out}/lib:${gst_all_1.gstreamer}/lib:${keybinder}/lib" \
       --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH" \
-      --prefix XDG_DATA_DIRS : "${gtk3}/share" \
+      --prefix XDG_DATA_DIRS : "${gtk3.out}/share" \
       --set GST_REGISTRY "/tmp/kazam.gstreamer.registry";
   '';
 
diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix
index e1dc182ba0b..792cb67f812 100644
--- a/pkgs/applications/video/kodi/default.nix
+++ b/pkgs/applications/video/kodi/default.nix
@@ -104,14 +104,10 @@ in stdenv.mkDerivation rec {
           --prefix PATH ":" "${pythonFull}/bin" \
           --prefix PATH ":" "${glxinfo}/bin" \
           --prefix PATH ":" "${xdpyinfo}/bin" \
-          --prefix LD_LIBRARY_PATH ":" "${curl}/lib" \
-          --prefix LD_LIBRARY_PATH ":" "${systemd}/lib" \
-          --prefix LD_LIBRARY_PATH ":" "${libmad}/lib" \
-          --prefix LD_LIBRARY_PATH ":" "${libvdpau}/lib" \
-          --prefix LD_LIBRARY_PATH ":" "${libcec}/lib" \
-          --prefix LD_LIBRARY_PATH ":" "${libcec_platform}/lib" \
+          --prefix LD_LIBRARY_PATH ":" "${lib.makeLibraryPath
+              [ curl systemd libmad libvdpau libcec libcec_platform rtmpdump ]
+            }"
           --prefix LD_LIBRARY_PATH ":" "${libass}/lib" \
-          --prefix LD_LIBRARY_PATH ":" "${rtmpdump}/lib"
       done
     '';
 
diff --git a/pkgs/applications/video/miro/default.nix b/pkgs/applications/video/miro/default.nix
index 6585306b289..5209cce36a1 100644
--- a/pkgs/applications/video/miro/default.nix
+++ b/pkgs/applications/video/miro/default.nix
@@ -33,7 +33,7 @@ buildPythonPackage rec {
     sed -i -e 's|/usr/bin/||' -e 's|/usr||' \
            -e 's/BUILD_TIME[^,]*/BUILD_TIME=0/' setup.py
 
-    sed -i -e 's|default="/usr/bin/ffmpeg"|default="${ffmpeg}/bin/ffmpeg"|' \
+    sed -i -e 's|default="/usr/bin/ffmpeg"|default="${ffmpeg.bin}/bin/ffmpeg"|' \
       plat/options.py
 
     sed -i -e 's|/usr/share/miro/themes|'"$out/share/miro/themes"'|' \
@@ -64,7 +64,7 @@ buildPythonPackage rec {
     mv "$out/bin/miro.real" "$out/bin/miro"
     wrapProgram "$out/bin/miro" \
       --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH" \
-      --prefix GIO_EXTRA_MODULES : "${glib_networking}/lib/gio/modules" \
+      --prefix GIO_EXTRA_MODULES : "${glib_networking.out}/lib/gio/modules" \
       --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH:$out/share"
   '';
 
diff --git a/pkgs/applications/video/vlc/default.nix b/pkgs/applications/video/vlc/default.nix
index 9f2ed3c3c5d..37583648a74 100644
--- a/pkgs/applications/video/vlc/default.nix
+++ b/pkgs/applications/video/vlc/default.nix
@@ -27,6 +27,8 @@ stdenv.mkDerivation rec {
     sha256 = "1jqzrzrpw6932lbkf863xk8cfmn4z2ngbxz7w8ggmh4f6xz9sgal";
   };
 
+  # outputs TODO: some modules are "corrupt", even without splitting vlc
+
   buildInputs =
     [ xz bzip2 perl zlib a52dec libmad faad2 ffmpeg alsaLib libdvdnav libdvdnav.libdvdread
       libbluray dbus fribidi libvorbis libtheora speex lua5 libgcrypt
diff --git a/pkgs/applications/virtualization/bochs/default.nix b/pkgs/applications/virtualization/bochs/default.nix
index b876403d632..d1150d7024b 100644
--- a/pkgs/applications/virtualization/bochs/default.nix
+++ b/pkgs/applications/virtualization/bochs/default.nix
@@ -143,8 +143,8 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional busMouse "--enable-busmouse"
     ;
 
-  NIX_CFLAGS_COMPILE="-I${gtk}/include/gtk-2.0/ -I${libtool}/include/";
-  NIX_LDFLAGS="-L${libtool}/lib";
+  NIX_CFLAGS_COMPILE="-I${gtk.dev}/include/gtk-2.0/ -I${libtool}/include/";
+  NIX_LDFLAGS="-L${libtool.lib}/lib";
 	
   meta = with stdenv.lib; {
     description = "An open-source IA-32 (x86) PC emulator";
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index b84272b7547..5e198607676 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -81,14 +81,14 @@ in stdenv.mkDerivation {
         -e 's@MKISOFS --version@MKISOFS -version@' \
         -e 's@PYTHONDIR=.*@PYTHONDIR=${if pythonBindings then python else ""}@' \
         -i configure
-    ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2
-    ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2
+    ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2
+    ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2
     find . -type f -iname '*makefile*' -exec sed -i -e 's/depmod -a/:/g' {} +
     sed -i -e '
-      s@"libdbus-1\.so\.3"@"${dbus}/lib/libdbus-1.so.3"@g
-      s@"libasound\.so\.2"@"${alsaLib}/lib/libasound.so.2"@g
+      s@"libdbus-1\.so\.3"@"${dbus.lib}/lib/libdbus-1.so.3"@g
+      s@"libasound\.so\.2"@"${alsaLib.out}/lib/libasound.so.2"@g
       ${optionalString pulseSupport ''
-      s@"libpulse\.so\.0"@"${libpulseaudio}/lib/libpulse.so.0"@g
+      s@"libpulse\.so\.0"@"${libpulseaudio.out}/lib/libpulse.so.0"@g
       ''}
     ' src/VBox/Main/xml/Settings.cpp \
       src/VBox/Devices/Audio/{alsa,pulse}_stubs.c \
diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
index 4ef62baa3d9..0d2e0568523 100644
--- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
@@ -63,19 +63,19 @@ stdenv.mkDerivation {
     for i in sbin/VBoxService bin/{VBoxClient,VBoxControl} lib/VBoxGuestAdditions/mount.vboxsf
     do
         ${if stdenv.system == "i686-linux" then ''
-          patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $i
+          patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $i
         ''
         else if stdenv.system == "x86_64-linux" then ''
-          patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $i
+          patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux-x86-64.so.2 $i
         ''
         else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
         }
-        patchelf --set-rpath ${stdenv.cc.cc}/lib:${dbus}/lib:${libX11}/lib:${libXt}/lib:${libXext}/lib:${libXmu}/lib:${libXfixes}/lib:${libXrandr}/lib:${libXcursor}/lib $i
+        patchelf --set-rpath ${lib.makeLibraryPath [ stdenv.cc.cc dbus libX11 libXt libXext libXmu libXfixes libXrandr libXcursor ]} $i
     done
 
     for i in lib/VBoxOGL*.so
     do
-        patchelf --set-rpath $out/lib:${dbus}/lib $i
+        patchelf --set-rpath $out/lib:${dbus.lib}/lib $i
     done
 
     # FIXME: Virtualbox 4.3.22 moved VBoxClient-all (required by Guest Additions
diff --git a/pkgs/applications/virtualization/xen/generic.nix b/pkgs/applications/virtualization/xen/generic.nix
index 71c26c5f99c..5f4147ea2cf 100644
--- a/pkgs/applications/virtualization/xen/generic.nix
+++ b/pkgs/applications/virtualization/xen/generic.nix
@@ -130,7 +130,7 @@ stdenv.mkDerivation {
         --replace /usr/bin/pkill ${procps}/bin/pkill
 
       substituteInPlace tools/xenstat/Makefile \
-        --replace /usr/include/curses.h ${ncurses}/include/curses.h
+        --replace /usr/include/curses.h ${ncurses.dev}/include/curses.h
 
       substituteInPlace tools/qemu-xen-traditional/xen-hooks.mak \
         --replace /usr/include/pci ${pciutils}/include/pci
diff --git a/pkgs/applications/window-managers/awesome/default.nix b/pkgs/applications/window-managers/awesome/default.nix
index 9c9d3d5f451..0e05afa0d60 100644
--- a/pkgs/applications/window-managers/awesome/default.nix
+++ b/pkgs/applications/window-managers/awesome/default.nix
@@ -60,8 +60,8 @@ stdenv.mkDerivation rec {
 
   #cmakeFlags = "-DGENERATE_MANPAGES=ON";
 
-  LD_LIBRARY_PATH = "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib";
-  GI_TYPELIB_PATH = "${pango}/lib/girepository-1.0";
+  LD_LIBRARY_PATH = "${stdenv.lib.makeLibraryPath [ cairo pango gobjectIntrospection ]}";
+  GI_TYPELIB_PATH = "${pango.out}/lib/girepository-1.0";
   LUA_CPATH = "${lgi}/lib/lua/${lua.luaversion}/?.so";
   LUA_PATH  = "${lgi}/share/lua/${lua.luaversion}/?.lua;${lgi}/share/lua/${lua.luaversion}/lgi/?.lua";
 
@@ -70,8 +70,8 @@ stdenv.mkDerivation rec {
       --prefix LUA_CPATH ";" '"${lgi}/lib/lua/${lua.luaversion}/?.so"' \
       --prefix LUA_PATH ";" '"${lgi}/share/lua/${lua.luaversion}/?.lua;${lgi}/share/lua/${lua.luaversion}/lgi/?.lua"' \
       --prefix GI_TYPELIB_PATH : "$GI_TYPELIB_PATH" \
-      --prefix LD_LIBRARY_PATH : "${cairo}/lib:${pango}/lib:${gobjectIntrospection}/lib" \
-      --prefix PATH : "${compton}/bin:${unclutter}/bin:${procps}/bin:${iproute}/sbin:${coreutils}/bin:${curl}/bin:${alsaUtils}/bin:${findutils}/bin:${xterm}/bin"
+      --prefix LD_LIBRARY_PATH : "$LD_LIBRARY_PATH" \
+      --prefix PATH : "${compton}/bin:${unclutter}/bin:${procps}/bin:${iproute}/sbin:${coreutils}/bin:${curl.bin}/bin:${alsaUtils}/bin:${findutils}/bin:${xterm}/bin"
 
     wrapProgram $out/bin/awesome-client \
       --prefix PATH : "${which}/bin"
diff --git a/pkgs/applications/window-managers/qtile/default.nix b/pkgs/applications/window-managers/qtile/default.nix
index 743530e3998..1043e3a1f64 100644
--- a/pkgs/applications/window-managers/qtile/default.nix
+++ b/pkgs/applications/window-managers/qtile/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, buildPythonPackage, python27Packages, pkgs }:
+{ stdenv, lib, fetchFromGitHub, buildPythonPackage, python27Packages, pkgs }:
 
 buildPythonPackage rec {
   name = "qtile-${version}";
@@ -20,20 +20,18 @@ buildPythonPackage rec {
   buildInputs = [ pkgs.pkgconfig pkgs.glib pkgs.xorg.libxcb pkgs.cairo pkgs.pango python27Packages.xcffib ];
 
   cairocffi-xcffib = python27Packages.cairocffi.override {
-    LD_LIBRARY_PATH = "${pkgs.xorg.libxcb}/lib:${pkgs.cairo}/lib";
+    inherit LD_LIBRARY_PATH;
     pythonPath = [ python27Packages.xcffib ];
   };
 
   pythonPath = with python27Packages; [ xcffib cairocffi-xcffib trollius readline ];
 
-  LD_LIBRARY_PATH = "${pkgs.xorg.libxcb}/lib:${pkgs.cairo}/lib";
+  LD_LIBRARY_PATH = "${lib.makeLibraryPath [ pkgs.xorg.libxcb pkgs.cairo ]}";
 
   postInstall = ''
     wrapProgram $out/bin/qtile \
-      --prefix LD_LIBRARY_PATH : ${pkgs.xorg.libxcb}/lib \
-      --prefix LD_LIBRARY_PATH : ${pkgs.glib}/lib \
-      --prefix LD_LIBRARY_PATH : ${pkgs.cairo}/lib \
-      --prefix LD_LIBRARY_PATH : ${pkgs.pango}/lib
+      --prefix LD_LIBRARY_PATH : \
+        "${LD_LIBRARY_PATH}:${lib.makeLibraryPath [ pkgs.glib pkgs.pango ]}"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/window-managers/weston/default.nix b/pkgs/applications/window-managers/weston/default.nix
index 862e8b0ea01..0720368222d 100644
--- a/pkgs/applications/window-managers/weston/default.nix
+++ b/pkgs/applications/window-managers/weston/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
     wayland mesa libxkbcommon cairo libxcb libXcursor xlibsWrapper udev libdrm
-    mtdev libjpeg pam dbus.libs libinput pango libunwind freerdp vaapi libva
+    mtdev libjpeg pam dbus libinput pango libunwind freerdp vaapi libva
     libwebp
   ];