anchor.diff:          find $out/include -name .install -exec rm {} \;
           find $out/include -name ..install.cmd -exec rm {} \;
           mv $out/include $out/include-glibc
  -
  +    '' else if (targetPlatform.libc == "musl") then ''
  +        # Copy what we need from musl
  +        cp ${libc.out}/lib/* $out/lib
  +        cp -rL ${libc.dev}/include $out
  +        chmod -R u+w "$out"
  +
  +        rm -rf $out/include/mtd $out/include/rdma $out/include/sound $out/include/video
  +        find $out/include -name .install -exec rm {} \;
  +        find $out/include -name ..install.cmd -exec rm {} \;
  +    '' else throw "unsupported libc for bootstrap tools")
  +    + ''
           # Copy coreutils, bash, etc.
           cp ${coreutilsMinimal.out}/bin/* $out/bin
           (cd $out/bin && rm vdir dir sha*sum pinky factor pathchk runcon shuf who whoami shred users)
  
positive.code:         set -x
          mkdir -p $out/bin $out/lib $out/libexec
  
          # Copy what we need of Glibc.
          cp -d ${glibc.out}/lib/ld*.so* $out/lib
          cp -d ${glibc.out}/lib/libc*.so* $out/lib
          cp -d ${glibc.out}/lib/libc_nonshared.a $out/lib
          cp -d ${glibc.out}/lib/libm*.so* $out/lib
          cp -d ${glibc.out}/lib/libdl*.so* $out/lib
          cp -d ${glibc.out}/lib/librt*.so*  $out/lib
          cp -d ${glibc.out}/lib/libpthread*.so* $out/lib
          cp -d ${glibc.out}/lib/libnsl*.so* $out/lib
          cp -d ${glibc.out}/lib/libutil*.so* $out/lib
          cp -d ${glibc.out}/lib/libnss*.so* $out/lib
          cp -d ${glibc.out}/lib/libresolv*.so* $out/lib
          cp -d ${glibc.out}/lib/crt?.o $out/lib
  
          cp -rL ${glibc.dev}/include $out
          chmod -R u+w "$out"
  
          # glibc can contain linker scripts: find them, copy their deps,
          # and get rid of absolute paths (nuke-refs would make them useless)
          local lScripts=$(grep --files-with-matches --max-count=1 'GNU ld script' -R "$out/lib")
          cp -d -t "$out/lib/" $(cat $lScripts | tr " " "\n" | grep -F '${glibc.out}' | sort -u)
          for f in $lScripts; do
            substituteInPlace "$f" --replace '${glibc.out}/lib/' ""
          done
  
          # Hopefully we won't need these.
  
negative.code: 
  let
    pkgs = import ../../.. { inherit localSystem crossSystem; };
    libc = if pkgs.hostPlatform != pkgs.buildPlatform
            then pkgs.libcCross
            else pkgs.glibc;
  in with pkgs; rec {
  