about summary refs log tree commit diff
path: root/pkgs/applications/window-managers
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/window-managers')
-rw-r--r--pkgs/applications/window-managers/sway/default.nix23
-rw-r--r--pkgs/applications/window-managers/sway/wrapper.nix3
2 files changed, 20 insertions, 6 deletions
diff --git a/pkgs/applications/window-managers/sway/default.nix b/pkgs/applications/window-managers/sway/default.nix
index 194525dcffb5..9ea6c1650ee0 100644
--- a/pkgs/applications/window-managers/sway/default.nix
+++ b/pkgs/applications/window-managers/sway/default.nix
@@ -1,6 +1,6 @@
 { lib, stdenv, fetchFromGitHub, substituteAll, swaybg
 , meson, ninja, pkg-config, wayland-scanner, scdoc
-, wayland, libxkbcommon, pcre, json_c, dbus, libevdev
+, wayland, libxkbcommon, pcre, json_c, libevdev
 , pango, cairo, libinput, libcap, pam, gdk-pixbuf, librsvg
 , wlroots, wayland-protocols, libdrm
 , nixosTests
@@ -8,8 +8,19 @@
 , isNixOS ? false
 
 , enableXWayland ? true
+, systemdSupport ? stdenv.isLinux
+, dbusSupport ? true
+, dbus
+, trayEnabled ? dbusSupport
 }:
 
+# The "sd-bus-provider" meson option does not include a "none" option,
+# but it is silently ignored iff "-Dtray=disabled".  We use "basu"
+# (which is not in nixpkgs) instead of "none" to alert us if this
+# changes: https://github.com/swaywm/sway/issues/6843#issuecomment-1047288761
+assert trayEnabled -> systemdSupport && dbusSupport;
+let sd-bus-provider = if systemdSupport then "libsystemd" else "basu"; in
+
 stdenv.mkDerivation rec {
   pname = "sway-unwrapped";
   version = "1.7";
@@ -47,16 +58,18 @@ stdenv.mkDerivation rec {
   ];
 
   buildInputs = [
-    wayland libxkbcommon pcre json_c dbus libevdev
+    wayland libxkbcommon pcre json_c libevdev
     pango cairo libinput libcap pam gdk-pixbuf librsvg
     wayland-protocols libdrm
     (wlroots.override { inherit enableXWayland; })
+  ] ++ lib.optionals dbusSupport [
+    dbus
   ];
 
-  mesonFlags = [
-    "-Dsd-bus-provider=libsystemd"
-  ]
+  mesonFlags =
+    [ "-Dsd-bus-provider=${sd-bus-provider}" ]
     ++ lib.optional (!enableXWayland) "-Dxwayland=disabled"
+    ++ lib.optional (!trayEnabled)    "-Dtray=disabled"
   ;
 
   passthru.tests.basic = nixosTests.sway;
diff --git a/pkgs/applications/window-managers/sway/wrapper.nix b/pkgs/applications/window-managers/sway/wrapper.nix
index 827fce897026..c1f531683d70 100644
--- a/pkgs/applications/window-managers/sway/wrapper.nix
+++ b/pkgs/applications/window-managers/sway/wrapper.nix
@@ -8,6 +8,7 @@
 , isNixOS ? false
 
 , enableXWayland ? true
+, dbusSupport ? true
 }:
 
 assert extraSessionCommands != "" -> withBaseWrapper;
@@ -27,7 +28,7 @@ let
        export DBUS_SESSION_BUS_ADDRESS
        exec ${sway}/bin/sway "$@"
      else
-       exec ${dbus}/bin/dbus-run-session ${sway}/bin/sway "$@"
+       exec ${if !dbusSupport then "" else "${dbus}/bin/dbus-run-session"} ${sway}/bin/sway "$@"
      fi
    '';
 in symlinkJoin {