{ config, inputs, lib, pkgs, ... }: let cfg = config.myOptions.services.greetd; inherit (config.myOptions.other.system) username; inherit (lib) getExe getExe' mkEnableOption mkIf mkOption; inherit (lib.types) listOf str; inherit (lib.strings) concatStringsSep; inherit (inputs.hyprland.packages.${pkgs.system}) hyprland; hyprctl = getExe' hyprland "hyprctl"; Hyprland = getExe' hyprland "Hyprland"; swww = getExe inputs.nixpkgs-wayland.packages.${pkgs.system}.swww; swww-daemon = getExe' inputs.nixpkgs-wayland.packages.${pkgs.system}.swww "swww-daemon"; greeter = getExe pkgs.greetd.${cfg.greeter}; hyprlandConfig = pkgs.writeText "greetd-hyprland-config" '' misc { force_default_wallpaper=0 focus_on_activate=1 } animations { enabled=0 first_launch_animation=0 } workspace=1,default:true,gapsout:0,gapsin:0,border:false,decorate:false exec-once=${swww-daemon} exec-once=${swww} clear 1E1E2E exec-once=[workspace 1;fullscreen;noanim] ${greeter} -l; ${hyprctl} dispatch exit exec-once=${hyprctl} dispatch focuswindow ${cfg.greeter} ''; in { options.myOptions.services.greetd = { enable = mkEnableOption "greetd"; greeter = mkOption { description = "greetd frontend to use"; type = str; }; launchOptions = mkOption { description = "/etc/greetd/environments as list of strings"; type = listOf str; }; }; config = mkIf cfg.enable { services.greetd = { enable = true; settings.default_session = { command = "${Hyprland} --config ${hyprlandConfig}"; user = username; }; }; environment.etc."greetd/environments".text = concatStringsSep "\n" cfg.launchOptions; }; }