buildFHSEnv: propagate host /etc if nested

This fixes use cases like launching Lutris/Heroic from Steam.
This commit is contained in:
K900 2023-12-16 10:04:09 +03:00
parent be1866d698
commit 5eb4128d60

View file

@ -149,6 +149,13 @@ let
done
fi
# propagate /etc from the actual host if nested
if [[ -e /.host-etc ]]; then
ro_mounts+=(--ro-bind /.host-etc /.host-etc)
else
ro_mounts+=(--ro-bind /etc /.host-etc)
fi
for i in ${lib.escapeShellArgs etcBindEntries}; do
if [[ "''${etc_ignored[@]}" =~ "$i" ]]; then
continue
@ -193,7 +200,6 @@ let
${lib.optionalString unshareCgroup "--unshare-cgroup"}
${lib.optionalString dieWithParent "--die-with-parent"}
--ro-bind /nix /nix
--ro-bind /etc /.host-etc
${lib.optionalString privateTmp "--tmpfs /tmp"}
# 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