refactor: modularize greeter

This commit is contained in:
Youwen Wu 2024-12-22 23:38:14 -08:00
parent 4c72a5cb8b
commit d00dcf0355
Signed by: youwen5
GPG key ID: 865658ED1FE61EC3
2 changed files with 47 additions and 19 deletions

View file

@ -27,6 +27,7 @@
theming = { theming = {
enable = true; enable = true;
}; };
desktop.greeter.enable = true;
}; };
boot = { boot = {

View file

@ -1,25 +1,52 @@
{ pkgs, ... }:
{ {
services.greetd = { pkgs,
enable = true; lib,
settings = { config,
default_session = { ...
command = '' }:
${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland --remember --greeting "Welcome, generation $(readlink /nix/var/nix/profiles/system | grep -o '[0-9]*'). Access is restricted to authorized personnel only." let
''; cfg = config.liminalOS.desktop.greeter;
user = "greeter"; in
}; {
options.liminalOS.desktop.greeter = {
enable = lib.mkOption {
type = lib.types.bool;
default = config.liminalOS.desktop.enable;
description = ''
Whether to enable and set up tui-greet, the default greeter for liminalOS.
'';
};
command = lib.mkOption {
type = lib.types.str;
default = if config.liminalOS.desktop.enable then "Hyprland" else "";
description = ''
Command for the greeter to execute to launch the desktop. If the liminalOS Hyprland Desktop is enabled, defaults to `Hyprland`.
'';
}; };
}; };
systemd.services.greetd.serviceConfig = { config = lib.mkIf cfg.enable {
Type = "idle"; services.greetd = {
StandardInput = "tty"; enable = true;
StandardOutput = "tty"; settings = {
StandardError = "journal"; # Without this errors will spam on screen default_session = {
# Without these bootlogs will spam on screen command = ''
TTYReset = true; ${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd Hyprland --remember --greeting "Welcome, generation $(readlink /nix/var/nix/profiles/system | grep -o '[0-9]*'). Access is restricted to authorized personnel only."
TTYVHangup = true; '';
TTYVTDisallocate = true; user = "greeter";
};
};
};
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;
};
}; };
} }