nixpkgs/pkgs/os-specific/linux/klibc/shrunk.nix

21 lines
482 B
Nix
Raw Normal View History

{stdenv, klibc}:
stdenv.mkDerivation {
name = "${klibc.name}-shrunk";
buildCommand = ''
ensureDir $out/lib
cp -prd ${klibc}/lib/klibc/bin $out/
cp -p ${klibc}/lib/*.so $out/lib/
chmod +w $out/*
old=$(echo ${klibc}/lib/klibc-*.so)
new=$(echo $out/lib/klibc-*.so)
for i in $out/bin/*; do
echo $i
sed "s^$old^$new^" -i $i
# !!! use patchelf
#patchelf --set-rpath /foo/bar $i
done
''; # */
allowedReferences = ["out"];
}