nixos/displayManager: interpolate option paths in docs + errors

This commit is contained in:
Matt Sturgeon
2026-06-02 18:25:30 +01:00
parent 3428007a7f
commit a3a6ad305f

View File

@@ -1,5 +1,6 @@
{
config,
options,
lib,
pkgs,
...
@@ -7,6 +8,7 @@
let
cfg = config.services.displayManager;
opts = options.services.displayManager;
installedSessions =
pkgs.runCommand "desktops"
@@ -79,7 +81,7 @@ in
default = config.user != null;
defaultText = lib.literalExpression "config.${options.user} != null";
description = ''
Automatically log in as {option}`autoLogin.user`.
Automatically log in as {option}`${options.user}`.
'';
};
@@ -185,14 +187,14 @@ in
{
assertion = cfg.autoLogin.enable -> cfg.autoLogin.user != null;
message = ''
services.displayManager.autoLogin.enable requires services.displayManager.autoLogin.user to be set
`${opts.autoLogin}.enable` requires `${opts.autoLogin}.user` to be set
'';
}
{
assertion = cfg.defaultSession == null || lib.elem cfg.defaultSession cfg.sessionData.sessionNames;
message = ''
Default graphical session, '${toString cfg.defaultSession}', not found.
Valid names for 'services.displayManager.defaultSession' are:
Valid names for `${opts.defaultSession}` are:
${lib.concatStringsSep "\n " cfg.sessionData.sessionNames}
'';
}