Files
moonix/modules/greetd.nix
T
nevaforget 050aa649cc fix(greetd): install regreet
niri-greeter.kdl spawns it by name. The regreet module only ever references the
binary through the default_session command it sets with mkDefault, and that is
overridden here with the niri greeter -- so nothing installed it and the greeter
came up with no UI, quit itself, and started over.
2026-08-31 13:58:54 +02:00

89 lines
3.0 KiB
Nix

# ABOUTME: Sets up greetd with regreet as the login greeter.
# ABOUTME: Counterpart to defaults/etc/greetd/ in the moonarch repo.
{ config, pkgs, lib, moonarchSrc, moonarchPkgs, moonarchThemes, ... }:
let
wallpaper = "${moonarchSrc}/defaults/backgrounds/wallpaper.jpg";
greeterNiriConfig = "${moonarchSrc}/defaults/etc/greetd/niri-greeter.kdl";
in
{
environment.etc."greetd/niri-greeter.kdl".source = greeterNiriConfig;
# niri-greeter.kdl spawns `regreet` by name, and the module only installs it
# through the default_session command that is overridden below.
environment.systemPackages = [ config.services.displayManager.regreet.package ];
# /etc/greetd/regreet.toml and regreet.css are written by the module, so
# defaults/etc/greetd/regreet.toml is not deployed verbatim: its wallpaper
# path points at /usr/share/moonarch/, which does not exist here. Every other
# value matches that file. Declaring those two paths in environment.etc would
# collide with the module.
services.displayManager.regreet = {
enable = true;
settings = {
background = {
path = wallpaper;
fit = "Cover";
};
GTK.application_prefer_dark_theme = true;
commands = {
reboot = [ "systemctl" "reboot" ];
poweroff = [ "systemctl" "poweroff" ];
};
};
# The rest of the GTK table is generated from these options.
theme = {
package = moonarchThemes.gtk;
name = "Colloid-Grey-Dark-Catppuccin";
};
iconTheme = {
package = moonarchThemes.icons;
name = "Colloid-Grey-Catppuccin-Dark";
};
cursorTheme = {
package = moonarchPkgs.sweet-cursors;
name = "Sweet-cursors";
};
font = {
package = pkgs.nerd-fonts.ubuntu-sans;
name = "UbuntuSans Nerd Font";
size = 12;
};
# readFile, not the path: the module only treats a direct /nix/store child
# as a path (lib.isStorePath), so passing this file's path as a string would
# write the path itself into /etc/greetd/regreet.css.
extraCss = builtins.readFile "${moonarchSrc}/defaults/etc/greetd/regreet.css";
};
services.greetd = {
enable = true;
# The option defaults to false as soon as a host sets initial_session, on
# the grounds that a restart would autologin again. greetd(5) says it does
# not: the initial session runs only on the first launch since boot, marked
# by a runfile under /run. Left at the default, logging out ends greetd and
# leaves a dead VT with no way back in.
restart = true;
settings.default_session = {
# regreet needs a Wayland compositor. niri instead of the module's cage
# default: niri-greeter.kdl carries the German keyboard layout, numlock
# and the cursor theme, and cage would come up with none of them.
command = "${lib.getExe pkgs.niri} -c /etc/greetd/niri-greeter.kdl";
user = "greeter";
};
};
# regreet walks XDG_DATA_DIRS for wayland-sessions/ and xsessions/.
environment.pathsToLink = [ "/share/wayland-sessions" "/share/xsessions" ];
}