niksos/modules/services/greetd.nix

53 lines
1.7 KiB
Nix
Raw Normal View History

2023-10-13 21:04:24 +02:00
{
config,
inputs,
lib,
pkgs,
...
}: with lib; let
cfg = config.myOptions.services.greetd;
username = config.myOptions.other.system.username;
2023-10-13 21:04:24 +02:00
hyprlandConfig = pkgs.writeText "greetd-hyprland-config" ''
misc {
force_default_wallpaper=0
2024-03-02 16:17:16 +01:00
focus_on_activate=1
2023-10-13 21:04:24 +02:00
}
2023-11-25 17:12:09 +01:00
animations {
enabled=0
first_launch_animation=0
}
2023-10-13 21:04:24 +02:00
workspace=1,default:true,gapsout:0,gapsin:0,border:false,decorate:false
${if config.myOptions.programs.waybar.enable then "exec-once=systemctl --user stop waybar.service" else ""}
exec-once=[workspace 1;fullscreen;noanim] ${pkgs.greetd.${cfg.greeter}}/bin/${cfg.greeter} -l; ${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/hyprctl dispatch exit
exec-once=${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/hyprctl dispatch focuswindow ${cfg.greeter}
'';
in {
options.myOptions.services.greetd = {
enable = mkEnableOption "enable greetd";
greeter = mkOption {
description = "greetd frontend to use";
type = types.str;
};
launchOptions = mkOption {
description = "/etc/greetd/environments as list of strings";
type = with types; listOf str;
};
};
config = mkIf cfg.enable {
services.greetd = {
enable = true;
settings.default_session = {
command = "${inputs.hyprland.packages.${pkgs.system}.hyprland}/bin/Hyprland --config ${hyprlandConfig}";
user = username;
2023-10-13 21:04:24 +02:00
};
};
environment.etc."greetd/environments".text = concatStringsSep "\n" cfg.launchOptions;
};
}