sway.nix
1 { config, lib, pkgs, ... }: 2 let 3 inherit (lib) mkIf mkEnableOption mkDefault; 4 cfg = config.modules.desktop.wayland.sway; 5 in 6 { 7 options = { 8 modules.desktop.wayland.sway = { 9 enable = mkEnableOption "Enable sway desktop profile"; 10 }; 11 }; 12 config = mkIf cfg.enable { 13 # Enable wayland desktop modules if not already 14 modules.desktop.wayland.enable = true; 15 16 # Enable pipewire 17 modules.hardware.audio = { 18 enable = true; 19 pipewire.enable = true; 20 }; 21 22 services.blueman.enable = config.modules.hardware.bluetooth.enable; 23 environment.sessionVariables = { 24 # only needed for Sway 25 XDG_CURRENT_DESKTOP = "sway"; 26 }; 27 xdg = { 28 portal = { 29 enable = true; 30 wlr.enable = true; 31 extraPortals = with pkgs; [ 32 xdg-desktop-portal-wlr 33 xdg-desktop-portal-gtk 34 ]; 35 }; 36 }; 37 38 # Allow swaylock to unlock the computer for us 39 security.pam.services.swaylock = { 40 text = "auth include login"; 41 }; 42 43 # FIXME are those needed 44 programs.dconf.enable = true; 45 services.dbus = { 46 enable = true; 47 packages = [ pkgs.dconf pkgs.gcr ]; 48 }; 49 }; 50 } 51