From 131aa12bba9e6653b60e2e3e49e259350b01beaf Mon Sep 17 00:00:00 2001 From: Alex David Date: Sat, 7 Jun 2025 15:26:50 -0700 Subject: [PATCH] Add `xwayland` combinator --- combinators.nix | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/combinators.nix b/combinators.nix index 12d30cb..a4edf0d 100644 --- a/combinators.nix +++ b/combinators.nix @@ -410,6 +410,35 @@ ; }; + xwayland = { + sig = "Combinator"; + doc = '' + Safely allow X11 apps to render to a wayland compositor. + + This combinator runs + [xwayland-satellite](https://github.com/Supreeeme/xwayland-satellite) + *inside the jail* and only exposes [wayland combinator](#wayland). + + This has the advantage of not allowing multiple jailed X11 applicaitons + to see each other since each jailed applicaiton gets its own + xwayland-satelite server. + + However, doing it this way does mean that every jailed applicaiton you + run with this combinator will spin up its own personal xwayland-satelite + server, which will consume more resources than having a global one. + ''; + impl = combinators: with combinators; + compose [ + wayland + (set-env "DISPLAY" ":42") + (wrap-entry (entry: '' + ${lib.getExe pkgs.xwayland-satellite} :42 & + ${entry} + '')) + ] + ; + }; + unsafe-x11 = { sig = "Combinator"; doc = '' @@ -417,6 +446,9 @@ Note that applications may be able to break out of the jail because X11 is not designed to be a security boundary. + + For a safer alternative, consider using the [xwayland](#xwayland) + combinator inside of a wayland compositor. ''; impl = combinators: with combinators; compose [