First commit
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.desktop.greeter;
|
||||
in
|
||||
{
|
||||
options.desktop.greeter = {
|
||||
enable = lib.mkEnableOption "greetd + tuigreet greeter (starts Hyprland)";
|
||||
|
||||
greeterConfSource = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = ../../../files/conf/greeter/greeter.conf;
|
||||
description = "Path to greeter.conf in your repo; will be installed to /etc/xdg/greeter/greeter.conf";
|
||||
};
|
||||
|
||||
vt = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 1;
|
||||
description = "Virtual terminal (VT) greetd runs on (typically 1).";
|
||||
};
|
||||
|
||||
extraArgs = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "--time" "--remember" "--remember-session" "--asterisks" ];
|
||||
description = "Extra command-line arguments passed to tuigreet.";
|
||||
};
|
||||
|
||||
useDbusRunSession = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Wrap Hyprland with dbus-run-session (often helps session env).";
|
||||
};
|
||||
|
||||
installGreeterPackages = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Add tuigreet (and optional qtgreet) to systemPackages.";
|
||||
};
|
||||
|
||||
enableTty1Fix = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = "Ensure greetd owns tty1 (avoids boot console overriding greetd).";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
# greetd + tuigreet configuration
|
||||
services.greetd = {
|
||||
enable = true;
|
||||
settings = {
|
||||
terminal.vt = cfg.vt;
|
||||
|
||||
default_session = {
|
||||
# greetd service runs the greeter as this user
|
||||
user = "greetd";
|
||||
|
||||
# Build: tuigreet ... --cmd <Hyprland>
|
||||
command =
|
||||
let
|
||||
hyprCmd =
|
||||
if cfg.useDbusRunSession
|
||||
then "${pkgs.dbus}/bin/dbus-run-session ${pkgs.hyprland}/bin/Hyprland"
|
||||
else "${pkgs.hyprland}/bin/Hyprland";
|
||||
|
||||
tuigreetArgs = lib.concatStringsSep " " cfg.extraArgs;
|
||||
in
|
||||
"${pkgs.tuigreet}/bin/tuigreet ${tuigreetArgs} --cmd ${hyprCmd}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Install your custom greeter config into /etc/xdg/greeter/greeter.conf
|
||||
environment.etc."xdg/greeter/greeter.conf".source = cfg.greeterConfSource;
|
||||
|
||||
# Supporting bits (Wayland sessions almost always want these)
|
||||
services.dbus.enable = lib.mkDefault true;
|
||||
security.polkit.enable = lib.mkDefault true;
|
||||
|
||||
# Optional: keep greeter tools available system-wide
|
||||
environment.systemPackages = lib.mkIf cfg.installGreeterPackages (with pkgs; [
|
||||
tuigreet
|
||||
qtgreet
|
||||
]);
|
||||
|
||||
# Fix "Graphical System started" but no greeter: ensure tty1 isn’t stolen by console/getty
|
||||
boot.kernelParams = lib.mkIf cfg.enableTty1Fix [ "console=tty1" ];
|
||||
systemd.services."getty@tty1".enable = lib.mkIf cfg.enableTty1Fix false;
|
||||
systemd.services."autovt@tty1".enable = lib.mkIf cfg.enableTty1Fix false;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user