some refactoring and modularizing locale

This commit is contained in:
cnst
2024-10-23 20:11:01 +02:00
parent 86046c6414
commit b7784f9b15
58 changed files with 256 additions and 165 deletions

View File

@@ -0,0 +1,58 @@
{
pkgs,
config,
lib,
...
}: let
inherit (lib) mkIf mkEnableOption mkMerge mkOption types;
cfg = config.nixos.services.system.greetd;
in {
options = {
nixos.services.system.greetd = {
enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables the greetd service.";
};
gnomeKeyring.enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables GnomeKeyring PAM service for greetd.";
};
autologin.enable = mkEnableOption {
type = types.bool;
default = false;
description = "Enables autologin for a specified user.";
};
autologin.user = mkOption {
type = types.str;
default = "cnst";
description = "The username to auto-login when autologin is enabled.";
};
};
};
config = mkIf cfg.enable {
services.greetd = {
enable = true;
settings = mkMerge [
# Conditionally include initial_session if autologin is enabled
(mkIf cfg.autologin.enable {
initial_session = {
command = "${pkgs.hyprland}/bin/Hyprland";
user = cfg.autologin.user;
};
})
{
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet -r --remember-session --asterisks";
user = "greeter";
};
}
];
};
# Apply GnomeKeyring PAM Service based on user configuration
security.pam.services.greetd.enableGnomeKeyring = cfg.gnomeKeyring.enable;
};
}