nix-config/modules/boot/greeter/greetd.nix
2026-01-02 23:38:43 +01:00

59 lines
1.5 KiB
Nix

{
lib,
config,
pkgs,
...
}: let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.horseman.boot.greeter.greetd;
homeCfg = config.horseman;
in {
options = {
horseman.boot.greeter.greetd = {
enable = mkEnableOption "Greetd Greeter";
session = mkOption {type = types.str;};
autoLogin = mkOption {
type = types.bool;
default = false;
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
tuigreet
];
services.greetd = {
enable = true;
settings =
{
default_session = {
user = homeCfg.username;
command = "${pkgs.tuigreet}/bin/tuigreet --time --remember --remember-session --greeting 'Please authenticate to continue' --asterisks --asterisks-char '*' --theme 'border=74;text=cyan;prompt=green;time=cyan;action=cyan;button=cyan;container=black;input=238' --cmd ${cfg.session}";
};
}
// (
if cfg.autoLogin
then {
initial_session = {
user = homeCfg.username;
command = cfg.session;
};
}
else {}
);
};
systemd.services.greetd.serviceConfig = {
Type = "idle";
StandardInput = "tty";
StandardOutput = "tty";
StandardError = "journal"; # Without this errors will spam on screen
# Without these bootlogs will spam on screen
TTYReset = true;
TTYVHangup = true;
TTYVTDisallocate = true;
};
};
}