diff options
author | Thomas Watson <twatson52@icloud.com> | 2024-05-16 10:14:07 -0500 |
---|---|---|
committer | Thomas Watson <twatson52@icloud.com> | 2024-05-16 10:14:07 -0500 |
commit | dd99084843ee2d94d2efb127231a6358f0cf0daf (patch) | |
tree | 1df1e4bc26fd7784810ee39110b3718fe64105d3 | |
parent | b3edf80d9628c03eeab0a10640f46ef24f7f72d7 (diff) |
buildFHSEnvBubblewrap: allow more varied $DISPLAY syntax
The $DISPLAY variable has a format of [host]:num[.screen]. Previously, the number would only be extracted properly if it had the form :num. Allow all forms but correctly discard the unused parts.
-rw-r--r-- | pkgs/build-support/build-fhsenv-bubblewrap/default.nix | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix index 12f3e7d585521..398a99e80e8cd 100644 --- a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix +++ b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix @@ -196,8 +196,10 @@ let 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#?} + if [[ "$DISPLAY" == *:* ]]; then + # recover display number from $DISPLAY formatted [host]:num[.screen] + display_nr=''${DISPLAY/#*:} # strip host + display_nr=''${display_nr/%.*} # strip screen local_socket=/tmp/.X11-unix/X$display_nr x11_args+=(--ro-bind-try "$local_socket" "$local_socket") fi |