nixdots/system/roles/workstation/display/login/greetd.nix
2024-06-25 01:37:46 +02:00

59 lines
1.4 KiB
Nix

{
config,
pkgs,
lib,
...
}: let
inherit (lib) mkIf getExe;
inherit (lib.strings) concatStringsSep;
deviceType = config.myOptions.device.roles.type;
acceptedTypes = ["laptop" "desktop"];
sessionData = config.services.displayManager.sessionData.desktops;
sessionPaths = concatStringsSep ":" [
"${sessionData}/share/xsessions"
"${sessionData}/share/wayland-sessions"
];
defaultSession = {
user = "greeter";
command = concatStringsSep " " [
(getExe pkgs.greetd.tuigreet)
"--time"
"--remember"
"--remember-user-session"
"--asterisks"
"--sessions '${sessionPaths}'"
];
};
in {
config = mkIf (builtins.elem deviceType acceptedTypes) {
services.greetd = {
enable = true;
vt = 2;
# <https://man.sr.ht/~kennylevinsen/greetd/>
settings = {
# default session is what will be used if no session is selected
# in this case it'll be a TUI greeter
default_session = defaultSession;
};
};
# Suppress error messages on tuigreet. They sometimes obscure the TUI
# boundaries of the greeter.
# See: https://github.com/apognu/tuigreet/issues/68#issuecomment-1586359960
systemd.services.greetd.serviceConfig = {
Type = "idle";
StandardInputs = "tty";
StandardOutput = "tty";
StandardError = "journal";
TTYReset = true;
TTYVHangup = true;
TTYVTDisallocate = true;
};
};
}