niksos/modules/services/greetd.nix

65 lines
1.7 KiB
Nix
Raw Normal View History

2023-10-13 21:04:24 +02:00
{
config,
inputs,
lib,
pkgs,
...
2024-07-24 16:30:22 +02:00
}: let
2024-07-15 23:18:25 +02:00
cfg = config.poz.services.greetd;
inherit (config.poz.other.system) username;
2023-10-13 21:04:24 +02:00
2024-07-24 18:47:53 +02:00
inherit (lib.meta) getExe getExe';
2024-07-25 11:45:44 +02:00
inherit (lib.modules) mkIf;
inherit (lib.options) mkEnableOption mkOption;
2024-05-05 12:38:40 +02:00
inherit (lib.strings) concatStringsSep;
2024-07-24 18:47:53 +02:00
inherit (lib.types) listOf str;
2024-05-05 12:38:40 +02:00
2024-05-09 18:51:15 +02:00
inherit (inputs.hyprland.packages.${pkgs.system}) hyprland;
hyprctl = getExe' hyprland "hyprctl";
Hyprland = getExe' hyprland "Hyprland";
greeter = getExe pkgs.greetd.${cfg.greeter};
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
exec-once=[workspace 1;fullscreen;noanim] ${greeter} -l; ${hyprctl} dispatch exit
exec-once=${hyprctl} dispatch focuswindow ${cfg.greeter}
2023-10-13 21:04:24 +02:00
'';
in {
2024-07-15 23:18:25 +02:00
options.poz.services.greetd = {
2024-04-05 22:59:32 +02:00
enable = mkEnableOption "greetd";
2023-10-13 21:04:24 +02:00
greeter = mkOption {
description = "greetd frontend to use";
2024-05-05 12:38:40 +02:00
type = str;
2023-10-13 21:04:24 +02:00
};
launchOptions = mkOption {
description = "/etc/greetd/environments as list of strings";
2024-05-05 12:38:40 +02:00
type = listOf str;
2023-10-13 21:04:24 +02:00
};
};
config = mkIf cfg.enable {
services.greetd = {
enable = true;
settings.default_session = {
command = "${Hyprland} --config ${hyprlandConfig}";
user = username;
2023-10-13 21:04:24 +02:00
};
};
environment.etc."greetd/environments".text = concatStringsSep "\n" cfg.launchOptions;
};
}