Files
moonix/modules/greetd.nix
T
nevaforget 06a0e68bea Emit a complete XML document in fonts.fontconfig.localConf
localConf is written to /etc/fonts/local.conf verbatim. Without the XML
declaration and the fontconfig root element, fontconfig rejects the file
with 'junk after document element' and the generic-family defaults never
take effect.
2026-08-07 14:47:36 +02:00

62 lines
2.2 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-theme = "Sweet-cursors"
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;
};
# moongreet caches the last user and session under /var/cache/moongreet.
# Without the directory it logs a permission error on every start.
systemd.tmpfiles.rules = [
"d /var/cache/moongreet 0755 greeter greeter -"
"d /var/cache/moongreet/last-session 0755 greeter greeter -"
];
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";
# moongreet walks XDG_DATA_DIRS for wayland-sessions/ and xsessions/.
# NixOS does not link those directories into the system profile by default.
environment.pathsToLink = [ "/share/wayland-sessions" "/share/xsessions" ];
# 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";
}