From a1909d73800a520b34640693343da7b68d5b7294 Mon Sep 17 00:00:00 2001
From: Tuomas Tynkkynen <tuomas@tuxera.com>
Date: Sun, 24 Jan 2016 09:29:16 +0200
Subject: [PATCH] treewide: Mass replace 'glibc}/lib' to refer the 'out' output

---
 nixos/modules/system/boot/initrd-network.nix | 2 +-
 pkgs/applications/audio/baudline/default.nix | 2 +-
 pkgs/applications/editors/idea/common.nix    | 2 +-
 pkgs/applications/misc/kiwix/default.nix     | 2 +-
 pkgs/development/compilers/ponyc/default.nix | 2 +-
 pkgs/games/dwarf-fortress/default.nix        | 2 +-
 pkgs/misc/cups/drivers/mfcj470dw/default.nix | 4 ++--
 pkgs/os-specific/linux/fusionio/util.nix     | 2 +-
 pkgs/servers/plex/default.nix                | 4 ++--
 pkgs/top-level/python-packages.nix           | 2 +-
 10 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/nixos/modules/system/boot/initrd-network.nix b/nixos/modules/system/boot/initrd-network.nix
index 6c6e2fafad43..d01222243f5d 100644
--- a/nixos/modules/system/boot/initrd-network.nix
+++ b/nixos/modules/system/boot/initrd-network.nix
@@ -102,7 +102,7 @@ in
     '' + optionalString cfg.ssh.enable ''
       copy_bin_and_libs ${pkgs.dropbear}/bin/dropbear
 
-      cp -pv ${pkgs.glibc}/lib/libnss_files.so.* $out/lib
+      cp -pv ${pkgs.glibc.out}/lib/libnss_files.so.* $out/lib
     '';
 
     boot.initrd.extraUtilsCommandsTest = optionalString cfg.ssh.enable ''
diff --git a/pkgs/applications/audio/baudline/default.nix b/pkgs/applications/audio/baudline/default.nix
index 543329ef679b..2d6b0434d6a1 100644
--- a/pkgs/applications/audio/baudline/default.nix
+++ b/pkgs/applications/audio/baudline/default.nix
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
     cp -r . "$out/libexec/baudline/"
 
-    interpreter="$(echo ${stdenv.glibc}/lib/ld-linux*)"
+    interpreter="$(echo ${stdenv.glibc.out}/lib/ld-linux*)"
     for prog in "$out"/libexec/baudline/baudline*; do
         patchelf --interpreter "$interpreter" "$prog"
         ln -sr "$prog" "$out/bin/"
diff --git a/pkgs/applications/editors/idea/common.nix b/pkgs/applications/editors/idea/common.nix
index 96689fa75ad6..979a374701f8 100644
--- a/pkgs/applications/editors/idea/common.nix
+++ b/pkgs/applications/editors/idea/common.nix
@@ -37,7 +37,7 @@ with stdenv; lib.makeOverridable mkDerivation rec {
         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/misc/kiwix/default.nix b/pkgs/applications/misc/kiwix/default.nix
index 30db6a45ea1b..d29e4fca3b29 100644
--- a/pkgs/applications/misc/kiwix/default.nix
+++ b/pkgs/applications/misc/kiwix/default.nix
@@ -93,7 +93,7 @@ stdenv.mkDerivation rec {
     make install
     cp -r src/dependencies/xulrunner $out/lib/kiwix
 
-    patchelf --set-interpreter ${glibc}/lib/ld-linux${optionalString (stdenv.system == "x86_64-linux") "-x86-64"}.so.2 $out/lib/kiwix/xulrunner/xulrunner
+    patchelf --set-interpreter ${glibc.out}/lib/ld-linux${optionalString (stdenv.system == "x86_64-linux") "-x86-64"}.so.2 $out/lib/kiwix/xulrunner/xulrunner
 
     rm $out/bin/kiwix
     makeWrapper $out/lib/kiwix/kiwix-launcher $out/bin/kiwix \
diff --git a/pkgs/development/compilers/ponyc/default.nix b/pkgs/development/compilers/ponyc/default.nix
index c94ba203c0ff..f05555003f98 100644
--- a/pkgs/development/compilers/ponyc/default.nix
+++ b/pkgs/development/compilers/ponyc/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   checkTarget = "test";
 
   patchPhase = ''
-    sed 's|/usr/lib/x86_64-linux-gnu/|${glibc}/lib/|g' -i src/libponyc/codegen/genexe.c
+    sed 's|/usr/lib/x86_64-linux-gnu/|${glibc.out}/lib/|g' -i src/libponyc/codegen/genexe.c
     sed 's|/lib/x86_64-linux-gnu/|${stdenv.cc.cc}/lib/|g' -i src/libponyc/codegen/genexe.c
   '';
 
diff --git a/pkgs/games/dwarf-fortress/default.nix b/pkgs/games/dwarf-fortress/default.nix
index 317981cd8877..97c793b8a39f 100644
--- a/pkgs/games/dwarf-fortress/default.nix
+++ b/pkgs/games/dwarf-fortress/default.nix
@@ -194,7 +194,7 @@ stdenv.mkDerivation rec {
     # Fix rpath
     patchelf --set-rpath "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc stdenv.glibc ]}:$out/share/df_linux/libs" $out/share/df_linux/libs/Dwarf_Fortress
 
-    patchelf --set-interpreter ${glibc}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
+    patchelf --set-interpreter ${glibc.out}/lib/ld-linux.so.2 $out/share/df_linux/libs/Dwarf_Fortress
 
     # Store new hash
     patched_hash=$(md5sum $out/share/df_linux/libs/Dwarf_Fortress | awk '{ print $1 }')
diff --git a/pkgs/misc/cups/drivers/mfcj470dw/default.nix b/pkgs/misc/cups/drivers/mfcj470dw/default.nix
index d1a1b239371a..b61344d1280e 100644
--- a/pkgs/misc/cups/drivers/mfcj470dw/default.nix
+++ b/pkgs/misc/cups/drivers/mfcj470dw/default.nix
@@ -33,8 +33,8 @@ stdenv.mkDerivation rec {
 
     sed -i '/GHOST_SCRIPT=/c\GHOST_SCRIPT=gs' $out/opt/brother/Printers/mfcj470dw/lpd/psconvertij2
 
-    patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/lpd/brmfcj470dwfilter
-    patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/cupswrapper/brcupsconfpt1
+    patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/lpd/brmfcj470dwfilter
+    patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/opt/brother/Printers/mfcj470dw/cupswrapper/brcupsconfpt1
 
     mkdir -p $out/lib/cups/filter/
     ln -s $out/opt/brother/Printers/mfcj470dw/lpd/filtermfcj470dw $out/lib/cups/filter/brother_lpdwrapper_mfcj470dw
diff --git a/pkgs/os-specific/linux/fusionio/util.nix b/pkgs/os-specific/linux/fusionio/util.nix
index e2f8d423a61d..e77d596dc6f8 100644
--- a/pkgs/os-specific/linux/fusionio/util.nix
+++ b/pkgs/os-specific/linux/fusionio/util.nix
@@ -18,7 +18,7 @@ stdenv.mkDerivation {
     cp -r $TMPDIR/{etc,usr/{bin,lib,share}} $out
     for BIN in $(find $out/bin -type f); do
       echo Patching $BIN
-      patchelf --set-interpreter "${glibc}/lib/ld-linux-x86-64.so.2" --set-rpath "${glibc}/lib:${gcc.cc}/lib:${libuuid}/lib:$out/lib" $BIN
+      patchelf --set-interpreter "${glibc.out}/lib/ld-linux-x86-64.so.2" --set-rpath "${glibc.out}/lib:${gcc.cc}/lib:${libuuid}/lib:$out/lib" $BIN
 
       # Test our binary to see if it was correctly patched
       set +e
diff --git a/pkgs/servers/plex/default.nix b/pkgs/servers/plex/default.nix
index 2aeb9379e10f..d88f7a89493d 100644
--- a/pkgs/servers/plex/default.nix
+++ b/pkgs/servers/plex/default.nix
@@ -27,12 +27,12 @@ stdenv.mkDerivation rec {
     # Now we need to patch up the executables and libraries to work on Nix.
     # Side note: PLEASE don't put spaces in your binary names. This is stupid.
     for bin in "Plex Media Server" "Plex DLNA Server" "Plex Media Scanner"; do
-      patchelf --set-interpreter "${glibc}/lib/ld-linux-x86-64.so.2" "$out/usr/lib/plexmediaserver/$bin"
+      patchelf --set-interpreter "${glibc.out}/lib/ld-linux-x86-64.so.2" "$out/usr/lib/plexmediaserver/$bin"
       patchelf --set-rpath "$out/usr/lib/plexmediaserver" "$out/usr/lib/plexmediaserver/$bin"
     done
 
     find $out/usr/lib/plexmediaserver/Resources -type f -a -perm -0100 \
-        -print -exec patchelf --set-interpreter "${glibc}/lib/ld-linux-x86-64.so.2" '{}' \;
+        -print -exec patchelf --set-interpreter "${glibc.out}/lib/ld-linux-x86-64.so.2" '{}' \;
 
     # executables need libstdc++.so.6
     ln -s "${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}/libstdc++.so.6" "$out/usr/lib/plexmediaserver/libstdc++.so.6"
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 12af1e32832e..64afc8d0b945 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -11339,7 +11339,7 @@ in modules // {
 
     patchPhase = optionalString stdenv.isLinux ''
       substituteInPlace monotonic.py --replace \
-        "ctypes.util.find_library('c')" "'${stdenv.glibc}/lib/libc.so.6'"
+        "ctypes.util.find_library('c')" "'${stdenv.glibc.out}/lib/libc.so.6'"
     '';
   };