buildFHSEnv: use symlinks instead of bind mounts for files from host /etc

Closes #247065
This commit is contained in:
Jeff Huffman
2023-12-09 00:26:55 -05:00
committed by Jonathan Ringer
parent 7046c894bd
commit 452b8162ec
@@ -150,10 +150,8 @@ let
if [[ "''${etc_ignored[@]}" =~ "$i" ]]; then
continue
fi
if [[ -L $i ]]; then
symlinks+=(--symlink "$(${coreutils}/bin/readlink "$i")" "$i")
else
ro_mounts+=(--ro-bind-try "$i" "$i")
if [[ -e $i ]]; then
symlinks+=(--symlink "/.host-etc/''${i#/etc/}" "$i")
fi
done
@@ -192,6 +190,7 @@ let
${lib.optionalString unshareCgroup "--unshare-cgroup"}
${lib.optionalString dieWithParent "--die-with-parent"}
--ro-bind /nix /nix
--ro-bind /etc /.host-etc
# Our glibc will look for the cache in its own path in `/nix/store`.
# As such, we need a cache to exist there, because pressure-vessel
# depends on the existence of an ld cache. However, adding one