From e26bb57b735d4ce3e931d5632ea1a3f0c7fbfcf4 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Sat, 30 May 2026 00:04:51 +0200 Subject: [PATCH] nixos/displayManager: replace ad-hoc type // { check } overrides Replace ad-hoc `type // { check }` overrides, which are incompatible with the v2 merge mechanism (see #454964). --- .../services/display-managers/default.nix | 41 ++++++------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/nixos/modules/services/display-managers/default.nix b/nixos/modules/services/display-managers/default.nix index 9b9937900b3b..418db90e7cc6 100644 --- a/nixos/modules/services/display-managers/default.nix +++ b/nixos/modules/services/display-managers/default.nix @@ -101,16 +101,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 = '' @@ -130,26 +121,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 = [ ]; @@ -211,6 +188,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