diff options
author | Jeff Huffman <tejing@tejing.com> | 2024-01-09 12:29:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-09 18:29:53 +0100 |
commit | a6671578ffa6336bfd1238f1b2a00662b5ab1b34 (patch) | |
tree | 67f20d3c9eb1fe00848a5dbf87073a8740015bdb | |
parent | f7be52b7fc55a487d406031cbd55218e69ea490e (diff) |
buildFHSEnv: bind dbus session bus into place when privateTmp enabled (#278917)
-rw-r--r-- | pkgs/build-support/build-fhsenv-bubblewrap/default.nix | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix index e13288371b5db..3292f4039a637 100644 --- a/pkgs/build-support/build-fhsenv-bubblewrap/default.nix +++ b/pkgs/build-support/build-fhsenv-bubblewrap/default.nix @@ -191,7 +191,21 @@ let # sddm places XAUTHORITY in /tmp if [[ "$XAUTHORITY" == /tmp/* ]]; then x11_args+=(--ro-bind-try "$XAUTHORITY" "$XAUTHORITY") - fi''} + fi + + # dbus-run-session puts the socket in /tmp + IFS=";" read -ra addrs <<<"$DBUS_SESSION_BUS_ADDRESS" + for addr in "''${addrs[@]}"; do + [[ "$addr" == unix:* ]] || continue + IFS="," read -ra parts <<<"''${addr#unix:}" + for part in "''${parts[@]}"; do + printf -v part '%s' "''${part//\\/\\\\}" + printf -v part '%b' "''${part//%/\\x}" + [[ "$part" == path=/tmp/* ]] || continue + x11_args+=(--ro-bind-try "''${part#path=}" "''${part#path=}") + done + done + ''} cmd=( ${bubblewrap}/bin/bwrap |