buildFHSUserEnv: fix permissions on /tmp/.X11-unix

This is kinda cursed, but it makes things like `steam-run gamescope` work OOTB.
This commit is contained in:
K900 2023-02-11 17:30:18 +03:00
parent 3a264219ee
commit 9788650f52

View file

@ -137,6 +137,18 @@ let
fi
done
declare -a x11_args
# Always mount a tmpfs on /tmp/.X11-unix
# Rationale: https://github.com/flatpak/flatpak/blob/be2de97e862e5ca223da40a895e54e7bf24dbfb9/common/flatpak-run.c#L277
x11_args+=(--tmpfs /tmp/.X11-unix)
# Try to guess X socket path. This doesn't cover _everything_, but it covers some things.
if [[ "$DISPLAY" == :* ]]; then
display_nr=''${DISPLAY#?}
local_socket=/tmp/.X11-unix/X$display_nr
x11_args+=(--ro-bind-try "$local_socket" "$local_socket")
fi
cmd=(
${bubblewrap}/bin/bwrap
--dev-bind /dev /dev
@ -171,6 +183,7 @@ let
"''${ro_mounts[@]}"
"''${symlinks[@]}"
"''${auto_mounts[@]}"
"''${x11_args[@]}"
${concatStringsSep "\n " extraBwrapArgs}
${init runScript}/bin/${name}-init ${initArgs}
)