Files
moonix/modules/greetd.nix
T
nevaforget 630faf5390 feat: regreet and swaylock from nixpkgs, autologin after LUKS
greetd.nix configures services.displayManager.regreet and keeps niri as
the greeter compositor, so niri-greeter.kdl stays the shared file that
carries the German keyboard layout. The moongreet input, its package and
pkgs/moongreet.nix are gone.

extraCss goes through builtins.readFile: the module only recognises a
direct /nix/store child as a path, so passing the file path as a string
wrote the path itself into /etc/greetd/regreet.css.

desktop.nix installs swaylock, seeds ~/.config/swaylock/config with the
wallpaper rewritten to the store path, and now owns the moonlock PAM
stack. The Colloid overrides moved to flake.nix so the greeter and the
desktop share one derivation.

initial_session is set per host because the accounts differ. greetd's
restart option flips itself off, verified.

flake.lock still pins moonarch at the pushed revision; it needs
`nix flake update moonarch` once the moonarch commit is pushed.
2026-08-14 14:32:43 +02:00

78 lines
2.4 KiB
Nix

# ABOUTME: Sets up greetd with regreet as the login greeter.
# ABOUTME: Counterpart to defaults/etc/greetd/ in the moonarch repo.
{ 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;
# /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;
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" ];
}