lol

nixos/programs: factor out wayland-session common options

+57 -36
+2 -3
nixos/modules/module-list.nix
··· 241 241 ./programs/starship.nix 242 242 ./programs/steam.nix 243 243 ./programs/streamdeck-ui.nix 244 - ./programs/sway.nix 245 244 ./programs/sysdig.nix 246 245 ./programs/system-config-printer.nix 247 246 ./programs/systemtap.nix ··· 256 255 ./programs/usbtop.nix 257 256 ./programs/vim.nix 258 257 ./programs/wavemon.nix 259 - ./programs/waybar.nix 258 + ./programs/wayland/sway.nix 259 + ./programs/wayland/waybar.nix 260 260 ./programs/weylus.nix 261 261 ./programs/wireshark.nix 262 262 ./programs/xastir.nix ··· 1308 1308 ./services/x11/window-managers/default.nix 1309 1309 ./services/x11/window-managers/fluxbox.nix 1310 1310 ./services/x11/window-managers/icewm.nix 1311 - ./services/x11/window-managers/bspwm.nix 1312 1311 ./services/x11/window-managers/katriawm.nix 1313 1312 ./services/x11/window-managers/metacity.nix 1314 1313 ./services/x11/window-managers/nimdow.nix
+29 -33
nixos/modules/programs/sway.nix nixos/modules/programs/wayland/sway.nix
··· 123 123 124 124 }; 125 125 126 - config = mkIf cfg.enable { 127 - assertions = [ 126 + config = mkIf cfg.enable 127 + (mkMerge [ 128 128 { 129 - assertion = cfg.extraSessionCommands != "" -> cfg.wrapperFeatures.base; 130 - message = '' 131 - The extraSessionCommands for Sway will not be run if 132 - wrapperFeatures.base is disabled. 133 - ''; 129 + assertions = [ 130 + { 131 + assertion = cfg.extraSessionCommands != "" -> cfg.wrapperFeatures.base; 132 + message = '' 133 + The extraSessionCommands for Sway will not be run if 134 + wrapperFeatures.base is disabled. 135 + ''; 136 + } 137 + ]; 138 + environment = { 139 + systemPackages = optional (cfg.package != null) cfg.package ++ cfg.extraPackages; 140 + # Needed for the default wallpaper: 141 + pathsToLink = optionals (cfg.package != null) [ "/share/backgrounds/sway" ]; 142 + etc = { 143 + "sway/config.d/nixos.conf".source = pkgs.writeText "nixos.conf" '' 144 + # Import the most important environment variables into the D-Bus and systemd 145 + # user environments (e.g. required for screen sharing and Pinentry prompts): 146 + exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP 147 + ''; 148 + } // optionalAttrs (cfg.package != null) { 149 + "sway/config".source = mkOptionDefault "${cfg.package}/etc/sway/config"; 150 + }; 151 + }; 152 + # To make a Sway session available if a display manager like SDDM is enabled: 153 + services.xserver.displayManager.sessionPackages = optionals (cfg.package != null) [ cfg.package ]; 134 154 } 135 - ]; 136 - environment = { 137 - systemPackages = optional (cfg.package != null) cfg.package ++ cfg.extraPackages; 138 - # Needed for the default wallpaper: 139 - pathsToLink = optionals (cfg.package != null) [ "/share/backgrounds/sway" ]; 140 - etc = { 141 - "sway/config.d/nixos.conf".source = pkgs.writeText "nixos.conf" '' 142 - # Import the most important environment variables into the D-Bus and systemd 143 - # user environments (e.g. required for screen sharing and Pinentry prompts): 144 - exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP 145 - ''; 146 - } // optionalAttrs (cfg.package != null) { 147 - "sway/config".source = mkOptionDefault "${cfg.package}/etc/sway/config"; 148 - }; 149 - }; 150 - security.polkit.enable = true; 151 - security.pam.services.swaylock = {}; 152 - hardware.opengl.enable = mkDefault true; 153 - fonts.enableDefaultFonts = mkDefault true; 154 - programs.dconf.enable = mkDefault true; 155 - # To make a Sway session available if a display manager like SDDM is enabled: 156 - services.xserver.displayManager.sessionPackages = optionals (cfg.package != null) [ cfg.package ]; 157 - programs.xwayland.enable = mkDefault true; 158 - # For screen sharing (this option only has an effect with xdg.portal.enable): 159 - xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-wlr ]; 160 - }; 155 + (import ./wayland-session.nix { inherit lib; }) 156 + ]); 161 157 162 158 meta.maintainers = with lib.maintainers; [ primeos colemickens ]; 163 159 }
nixos/modules/programs/waybar.nix nixos/modules/programs/wayland/waybar.nix
+26
nixos/modules/programs/wayland/wayland-session.nix
··· 1 + { lib, ... }: with lib; { 2 + 3 + security = { 4 + polkit.enable = true; 5 + pam.services.swaylock = {}; 6 + }; 7 + 8 + hardware.opengl.enable = mkDefault true; 9 + 10 + fonts.enableDefaultFonts = mkDefault true; 11 + 12 + programs = { 13 + dconf.enable = mkDefault true; 14 + xwayland.enable = mkDefault true; 15 + }; 16 + 17 + 18 + xdg.portal = { 19 + enable = mkDefault true; 20 + 21 + extraPortals = [ 22 + # For screen sharing 23 + pkgs.xdg-desktop-portal-wlr 24 + ]; 25 + }; 26 + }