···
29
-
swayPackage = pkgs.sway.override {
29
+
defaultSwayPackage = pkgs.sway.override {
extraSessionCommands = cfg.extraSessionCommands;
extraOptions = cfg.extraOptions;
withBaseWrapper = cfg.wrapperFeatures.base;
···
~/.config/sway/config to modify the default configuration. See
<https://github.com/swaywm/sway/wiki> and
"man 5 sway" for more information'');
45
+
package = mkOption {
46
+
type = with types; nullOr package;
47
+
default = defaultSwayPackage;
48
+
defaultText = literalExpression "pkgs.sway";
49
+
description = lib.mdDoc ''
50
+
Sway package to use. Will override the options
51
+
'wrapperFeatures', 'extraSessionCommands', and 'extraOptions'.
52
+
Set to <code>null</code> to not add any Sway package to your
53
+
path. This should be done if you want to use the Home Manager Sway
54
+
module to install Sway.
wrapperFeatures = mkOption {
···
124
-
systemPackages = [ swayPackage ] ++ cfg.extraPackages;
137
+
systemPackages = optional (cfg.package != null) cfg.package ++ cfg.extraPackages;
# Needed for the default wallpaper:
126
-
pathsToLink = [ "/share/backgrounds/sway" ];
139
+
pathsToLink = optionals (cfg.package != null) [ "/share/backgrounds/sway" ];
128
-
"sway/config".source = mkOptionDefault "${swayPackage}/etc/sway/config";
"sway/config.d/nixos.conf".source = pkgs.writeText "nixos.conf" ''
# Import the most important environment variables into the D-Bus and systemd
# user environments (e.g. required for screen sharing and Pinentry prompts):
exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
146
+
} // optionalAttrs (cfg.package != null) {
147
+
"sway/config".source = mkOptionDefault "${cfg.package}/etc/sway/config";
security.polkit.enable = true;
···
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
# To make a Sway session available if a display manager like SDDM is enabled:
142
-
services.xserver.displayManager.sessionPackages = [ swayPackage ];
156
+
services.xserver.displayManager.sessionPackages = optionals (cfg.package != null) [ cfg.package ];
programs.xwayland.enable = mkDefault true;
# For screen sharing (this option only has an effect with xdg.portal.enable):
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ];