{ pkgs, inputs, ... }: { imports = [ inputs.niri.nixosModules.niri ]; programs.niri.enable = true; # Enable UWSM (Universal Wayland Session Manager) for better session management # See docs/uwsm-niri-integration.md for usage and migration guide programs.uwsm = { enable = true; waylandCompositors = { niri = { prettyName = "Niri"; comment = "Niri scrollable-tiling Wayland compositor managed by UWSM"; binPath = "/run/current-system/sw/bin/niri-session"; }; }; }; # UWSM provides better environment variable inheritance and systemd integration # All startup applications are now managed via systemd.user.services with # WantedBy=["graphical-session.target"] in the home-manager configuration # Use KDE portal instead of GNOME for better KDE integration xdg.portal = { enable = true; extraPortals = with pkgs; [ kdePackages.xdg-desktop-portal-kde ]; config.common.default = "kde"; }; # Use KDE polkit for authentication instead of GNOME security.polkit.enable = true; systemd = { user.services.polkit-kde-authentication-agent-1 = { description = "polkit-kde-authentication-agent-1"; wantedBy = ["graphical-session.target"]; wants = ["graphical-session.target"]; after = ["graphical-session.target"]; serviceConfig = { Type = "simple"; ExecStart = "${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1"; Restart = "on-failure"; RestartSec = 1; TimeoutStopSec = 10; }; }; }; environment.sessionVariables.NIXOS_OZONE_WL = "1"; }