diff --git a/modules/services/window-managers/i3-sway/sway.nix b/modules/services/window-managers/i3-sway/sway.nix index 5568d6ab3bcb..dfcba2e97659 100644 --- a/modules/services/window-managers/i3-sway/sway.nix +++ b/modules/services/window-managers/i3-sway/sway.nix @@ -320,13 +320,6 @@ let exec "${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP XDG_SESSION_TYPE NIXOS_OZONE_WL; systemctl --user start sway-session.target"'') ++ (optional (!cfg.xwayland) "xwayland disable") ++ [ cfg.extraConfig ])); - defaultSwayPackage = pkgs.sway.override { - extraSessionCommands = cfg.extraSessionCommands; - extraOptions = cfg.extraOptions; - withBaseWrapper = cfg.wrapperFeatures.base; - withGtkWrapper = cfg.wrapperFeatures.gtk; - }; - in { meta.maintainers = with maintainers; [ Scrumplex @@ -347,8 +340,9 @@ in { package = mkOption { type = with types; nullOr package; - default = defaultSwayPackage; - defaultText = literalExpression "${pkgs.sway}"; + default = pkgs.sway-unwrapped; + defaultText = literalExpression "pkgs.sway-unwrapped"; + example = literalExpression "pkgs.swayfx"; description = '' Sway package to use. Will override the options 'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'. @@ -358,6 +352,13 @@ in { ''; }; + finalPackage = mkOption { + type = types.package; + visible = false; + readOnly = true; + description = "Resulting customized sway package."; + }; + systemd = { enable = mkOption { type = types.bool; @@ -476,17 +477,26 @@ in { platforms.linux) ]; - home.packages = optional (cfg.package != null) cfg.package + wayland.windowManager.sway.finalPackage = let + swayUnwrapped = + if cfg.package == null then pkgs.sway-unwrapped else cfg.package; + in pkgs.sway.override { + extraSessionCommands = cfg.extraSessionCommands; + extraOptions = cfg.extraOptions; + withBaseWrapper = cfg.wrapperFeatures.base; + withGtkWrapper = cfg.wrapperFeatures.gtk; + sway-unwrapped = swayUnwrapped; + }; + + home.packages = optional (cfg.package != null) cfg.finalPackage ++ optional cfg.xwayland pkgs.xwayland; - xdg.configFile."sway/config" = let - swayPackage = if cfg.package == null then pkgs.sway else cfg.package; - in { + xdg.configFile."sway/config" = { source = configFile; onChange = '' swaySocket="''${XDG_RUNTIME_DIR:-/run/user/$UID}/sway-ipc.$UID.$(${pkgs.procps}/bin/pgrep --uid $UID -x sway || true).sock" if [ -S "$swaySocket" ]; then - ${swayPackage}/bin/swaymsg -s $swaySocket reload + ${cfg.finalPackage}/bin/swaymsg -s $swaySocket reload fi ''; }; diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf index 795ad59d9cce..61d3f08ebaa7 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.conf @@ -87,7 +87,7 @@ bar { hidden_state hide position bottom status_command @i3status@/bin/i3status - swaybar_command @sway@/bin/swaybar + swaybar_command /nix/store/00000000000000000000000000000000-sway-unwrapped/bin/swaybar workspace_buttons yes strip_workspace_numbers no tray_output primary diff --git a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix index 399790fbed87..b00c26b9015b 100644 --- a/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix +++ b/tests/modules/services/window-managers/sway/sway-bar-focused-colors.nix @@ -5,7 +5,6 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf index 8b11cc1f644a..770ab77938a4 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.conf @@ -89,7 +89,7 @@ bar { hidden_state hide position bottom status_command @i3status@/bin/i3status - swaybar_command @sway@/bin/swaybar + swaybar_command /nix/store/00000000000000000000000000000000-sway-unwrapped/bin/swaybar workspace_buttons yes strip_workspace_numbers no tray_output primary diff --git a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix index 0817837acc60..8c375017af55 100644 --- a/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix +++ b/tests/modules/services/window-managers/sway/sway-bindkeys-to-code-and-extra-config.nix @@ -5,7 +5,6 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; config.bindkeysToCode = true; diff --git a/tests/modules/services/window-managers/sway/sway-default.conf b/tests/modules/services/window-managers/sway/sway-default.conf index be916062020c..ed7d94153432 100644 --- a/tests/modules/services/window-managers/sway/sway-default.conf +++ b/tests/modules/services/window-managers/sway/sway-default.conf @@ -87,7 +87,7 @@ bar { hidden_state hide position bottom status_command @i3status@/bin/i3status - swaybar_command @sway@/bin/swaybar + swaybar_command /nix/store/00000000000000000000000000000000-sway-unwrapped/bin/swaybar workspace_buttons yes strip_workspace_numbers no tray_output primary diff --git a/tests/modules/services/window-managers/sway/sway-default.nix b/tests/modules/services/window-managers/sway/sway-default.nix index 59527247b4b4..ec7974614764 100644 --- a/tests/modules/services/window-managers/sway/sway-default.nix +++ b/tests/modules/services/window-managers/sway/sway-default.nix @@ -5,7 +5,6 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; }; diff --git a/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix b/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix index 03f64fc24d7c..939d8582cd26 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix +++ b/tests/modules/services/window-managers/sway/sway-followmouse-legacy.nix @@ -5,7 +5,6 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; config = { focus.followMouse = false; diff --git a/tests/modules/services/window-managers/sway/sway-followmouse.nix b/tests/modules/services/window-managers/sway/sway-followmouse.nix index b8a2bc1693d3..f691fb837aae 100644 --- a/tests/modules/services/window-managers/sway/sway-followmouse.nix +++ b/tests/modules/services/window-managers/sway/sway-followmouse.nix @@ -5,7 +5,6 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; config = { focus.followMouse = "always"; diff --git a/tests/modules/services/window-managers/sway/sway-modules.conf b/tests/modules/services/window-managers/sway/sway-modules.conf index b53d95bffeaa..64410787a2c5 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.conf +++ b/tests/modules/services/window-managers/sway/sway-modules.conf @@ -99,7 +99,7 @@ bar { hidden_state hide position bottom status_command @i3status@/bin/i3status - swaybar_command @sway@/bin/swaybar + swaybar_command /nix/store/00000000000000000000000000000000-sway-unwrapped/bin/swaybar workspace_buttons yes strip_workspace_numbers no tray_output primary diff --git a/tests/modules/services/window-managers/sway/sway-modules.nix b/tests/modules/services/window-managers/sway/sway-modules.nix index b8aa58c56ca7..5f40dc79dc0d 100644 --- a/tests/modules/services/window-managers/sway/sway-modules.nix +++ b/tests/modules/services/window-managers/sway/sway-modules.nix @@ -5,7 +5,7 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + # overriding findutils causes issues config = { menu = "${pkgs.dmenu}/bin/dmenu_run"; diff --git a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix index b40912671aa7..2a7b622cd947 100644 --- a/tests/modules/services/window-managers/sway/sway-no-xwayland.nix +++ b/tests/modules/services/window-managers/sway/sway-no-xwayland.nix @@ -5,7 +5,7 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + config = null; systemd.enable = false; xwayland = false; diff --git a/tests/modules/services/window-managers/sway/sway-null-config.nix b/tests/modules/services/window-managers/sway/sway-null-config.nix index a859e04e6747..07b7afbdb221 100644 --- a/tests/modules/services/window-managers/sway/sway-null-config.nix +++ b/tests/modules/services/window-managers/sway/sway-null-config.nix @@ -5,7 +5,7 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + config = null; systemd.enable = false; }; diff --git a/tests/modules/services/window-managers/sway/sway-null-package.conf b/tests/modules/services/window-managers/sway/sway-null-package.conf index be916062020c..5ac7038adb92 100644 --- a/tests/modules/services/window-managers/sway/sway-null-package.conf +++ b/tests/modules/services/window-managers/sway/sway-null-package.conf @@ -87,7 +87,7 @@ bar { hidden_state hide position bottom status_command @i3status@/bin/i3status - swaybar_command @sway@/bin/swaybar + swaybar_command /nix/store/00000000000000000000000000000000-sway/bin/swaybar workspace_buttons yes strip_workspace_numbers no tray_output primary diff --git a/tests/modules/services/window-managers/sway/sway-post-2003.nix b/tests/modules/services/window-managers/sway/sway-post-2003.nix index 72e1fd9eaeab..fb4e0f098ae6 100644 --- a/tests/modules/services/window-managers/sway/sway-post-2003.nix +++ b/tests/modules/services/window-managers/sway/sway-post-2003.nix @@ -7,7 +7,7 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; }; diff --git a/tests/modules/services/window-managers/sway/sway-stubs.nix b/tests/modules/services/window-managers/sway/sway-stubs.nix index 2ae673c78119..34cc9605806b 100644 --- a/tests/modules/services/window-managers/sway/sway-stubs.nix +++ b/tests/modules/services/window-managers/sway/sway-stubs.nix @@ -5,9 +5,6 @@ dmenu = { }; foot = { }; i3status = { }; - sway = { }; - sway-unwrapped = { version = "1"; }; swaybg = { }; - xwayland = { }; }; } diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf index 34924bb1a863..25f07abc1e23 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-default-expected.conf @@ -86,7 +86,7 @@ bar { hidden_state hide position bottom status_command @i3status@/bin/i3status - swaybar_command @sway@/bin/swaybar + swaybar_command /nix/store/00000000000000000000000000000000-sway-unwrapped/bin/swaybar workspace_buttons yes strip_workspace_numbers no tray_output primary diff --git a/tests/modules/services/window-managers/sway/sway-workspace-default.nix b/tests/modules/services/window-managers/sway/sway-workspace-default.nix index 6af944eb0126..2bb5c3d1e7c1 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-default.nix +++ b/tests/modules/services/window-managers/sway/sway-workspace-default.nix @@ -5,7 +5,7 @@ wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run"; config.defaultWorkspace = "workspace number 9"; diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf index 2e02cec602ee..979a3f994925 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf +++ b/tests/modules/services/window-managers/sway/sway-workspace-output-expected.conf @@ -87,7 +87,7 @@ bar { hidden_state hide position bottom status_command @i3status@/bin/i3status - swaybar_command @sway@/bin/swaybar + swaybar_command /nix/store/00000000000000000000000000000000-sway-unwrapped/bin/swaybar workspace_buttons yes strip_workspace_numbers no tray_output primary diff --git a/tests/modules/services/window-managers/sway/sway-workspace-output.nix b/tests/modules/services/window-managers/sway/sway-workspace-output.nix index e096aa1f4868..35b77f82a7bc 100644 --- a/tests/modules/services/window-managers/sway/sway-workspace-output.nix +++ b/tests/modules/services/window-managers/sway/sway-workspace-output.nix @@ -13,7 +13,7 @@ in { wayland.windowManager.sway = { enable = true; - package = config.lib.test.mkStubPackage { outPath = "@sway@"; }; + # overriding findutils causes issues config.menu = "${pkgs.dmenu}/bin/dmenu_run";