Files
moonix/modules/greetd.nix
T
nevaforget b24d91e518 Boot into graphical.target so greetd starts
greetd is WantedBy=graphical.target, but an install without a desktop
defaults to multi-user.target and never activates it.
2026-08-07 12:38:04 +02:00

50 lines
1.6 KiB
Nix

# ABOUTME: Sets up greetd with moongreet as the login greeter.
# ABOUTME: Counterpart to defaults/etc/greetd/ in the moonarch repo.
{ pkgs, lib, moonarchSrc, moonarchPkgs, ... }:
let
wallpaper = "${moonarchSrc}/defaults/backgrounds/wallpaper.jpg";
# moongreet.toml cannot be copied verbatim: the upstream file points at
# /usr/share/moonarch/wallpaper.jpg, which does not exist under Nix.
# Everything else matches defaults/etc/moongreet/moongreet.toml.
moongreetConfig = pkgs.writeText "moongreet.toml" ''
[appearance]
background = "${wallpaper}"
cursor-size = 24
'';
greeterNiriConfig = "${moonarchSrc}/defaults/etc/greetd/niri-greeter.kdl";
in
{
environment.etc = {
"greetd/niri-greeter.kdl".source = greeterNiriConfig;
"moongreet/moongreet.toml".source = moongreetConfig;
};
services.greetd = {
enable = true;
settings = {
terminal.vt = 1;
default_session = {
# moongreet needs a Wayland compositor; niri provides it.
command = "${lib.getExe pkgs.niri} -c /etc/greetd/niri-greeter.kdl";
user = "greeter";
};
};
};
# greetd is WantedBy=graphical.target. An installation without a desktop
# boots into multi-user.target, where the unit never starts.
systemd.defaultUnit = "graphical.target";
# The greeter session spawns `moongreet` by name from niri-greeter.kdl,
# so it has to resolve in PATH.
environment.systemPackages = [ moonarchPkgs.moongreet ];
# PAM stack for moonlock, shipped by the package but owned by the system.
security.pam.services.moonlock.text =
builtins.readFile "${moonarchPkgs.moonlock}/share/moonlock/moonlock-pam";
}