{ lib, config, pkgs, inputs, ... }: let cfg = config.snowhawk.dwl; in { options.snowhawk.dwl = { enable = lib.mkEnableOption "dwl"; package = lib.mkOption { type = with lib.types; package; default = inputs.zdwl.packages."x86_64-linux".default; apply = p: p.overrideAttrs { postInstall = '' mkdir -p $out/share/wayland-sessions install $src/dwl.desktop -Dt $out/share/wayland-sessions ''; passthru.providedSessions = [ "dwl" ]; }; }; }; config = lib.mkIf cfg.enable { services.graphical-desktop.enable = lib.mkDefault true; services.displayManager = { enable = true; sessionPackages = [ cfg.package ]; defaultSession = "dwl"; # TODO: greetd? sddm = { enable = lib.mkDefault true; wayland.enable = lib.mkDefault true; }; }; security = { polkit.enable = lib.mkDefault true; # Uncomment to make swaylock work # pam.services.swaylock = { }; }; # environment.sessionVariables.NIXOS_OZONE_WL = "1"; programs = { dconf.enable = lib.mkDefault true; xwayland.enable = lib.mkDefault true; }; xdg.portal.wlr.enable = lib.mkDefault true; xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk pkgs.xdg-desktop-portal-wlr ]; # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1050913 xdg.portal.config.dwl.default = lib.mkDefault [ "wlr" "gtk" ]; services.xserver.desktopManager.runXdgAutostartIfNone = lib.mkDefault true; environment.systemPackages = with pkgs; [ (flameshot.override { enableWlrSupport = true; }) wl-clipboard wmenu kitty cfg.package ]; }; }