mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
[Backport release-25.11] nixos/displayManager: replace ad-hoc type // { check } overrides (#527214)
This commit is contained in:
@@ -120,16 +120,7 @@ in
|
||||
};
|
||||
|
||||
defaultSession = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str // {
|
||||
description = "session name";
|
||||
check =
|
||||
d:
|
||||
lib.assertMsg (d != null -> (lib.types.str.check d && lib.elem d cfg.sessionData.sessionNames)) ''
|
||||
Default graphical session, '${d}', not found.
|
||||
Valid names for 'services.displayManager.defaultSession' are:
|
||||
${lib.concatStringsSep "\n " cfg.sessionData.sessionNames}
|
||||
'';
|
||||
};
|
||||
type = lib.types.nullOr (lib.types.str // { description = "session name"; });
|
||||
default = null;
|
||||
example = "gnome";
|
||||
description = ''
|
||||
@@ -149,26 +140,12 @@ in
|
||||
|
||||
sessionPackages = lib.mkOption {
|
||||
type = lib.types.listOf (
|
||||
lib.types.package
|
||||
lib.types.addCheck lib.types.package (
|
||||
p: p ? providedSessions && p.providedSessions != [ ] && lib.all lib.isString p.providedSessions
|
||||
)
|
||||
// {
|
||||
description = "package with provided sessions";
|
||||
check =
|
||||
p:
|
||||
lib.assertMsg
|
||||
(
|
||||
lib.types.package.check p
|
||||
&& p ? providedSessions
|
||||
&& p.providedSessions != [ ]
|
||||
&& lib.all lib.isString p.providedSessions
|
||||
)
|
||||
''
|
||||
Package, '${p.name}', did not specify any session names, as strings, in
|
||||
'passthru.providedSessions'. This is required when used as a session package.
|
||||
|
||||
The session names can be looked up in:
|
||||
${p}/share/xsessions
|
||||
${p}/share/wayland-sessions
|
||||
'';
|
||||
descriptionClass = "composite";
|
||||
}
|
||||
);
|
||||
default = [ ];
|
||||
@@ -230,6 +207,14 @@ in
|
||||
services.displayManager.autoLogin.enable requires services.displayManager.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:
|
||||
${lib.concatStringsSep "\n " cfg.sessionData.sessionNames}
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
# Make xsessions and wayland sessions available in XDG_DATA_DIRS
|
||||
|
||||
Reference in New Issue
Block a user