Files
nixos-config/modules/desktop/greetd.nix
2026-02-01 00:42:40 +08:00

41 lines
947 B
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.my.desktop.greetd;
in
{
options.my.desktop.greetd = {
user = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "User account that runs the default session.";
};
command = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
description = "Command to run for the default session (use an absolute path).";
};
};
config = {
assertions = [
{
assertion = cfg.user != null;
message = "my.desktop.greetd.user must be set.";
}
{
assertion = cfg.command != null;
message = "my.desktop.greetd.command must be set (use an absolute path like \"${pkgs.sway}/bin/sway\").";
}
];
services.greetd = {
enable = true;
settings.default_session = {
user = cfg.user;
command = cfg.command;
};
};
};
}