diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index b393167ae2c..39b27d4ceb6 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -91,7 +91,7 @@ in example = "plasma5"; description = "Default desktop manager loaded if none have been chosen."; apply = defaultDM: - if defaultDM == "" && cfg.session.list != [] then + if defaultDM == "none" && cfg.session.list != [] then (head cfg.session.list).name else if any (w: w.name == defaultDM) cfg.session.list then defaultDM diff --git a/nixos/modules/services/x11/window-managers/default.nix b/nixos/modules/services/x11/window-managers/default.nix index d12003768a6..25ba95fccd7 100644 --- a/nixos/modules/services/x11/window-managers/default.nix +++ b/nixos/modules/services/x11/window-managers/default.nix @@ -61,7 +61,9 @@ in example = "wmii"; description = "Default window manager loaded if none have been chosen."; apply = defaultWM: - if any (w: w.name == defaultWM) cfg.session then + if defaultWM == "none" && cfg.session != [] then + (head cfg.session).name + else if any (w: w.name == defaultWM) cfg.session then defaultWM else throw "Default window manager (${defaultWM}) not found."; diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index 58dc75bcb4e..7d544e153e9 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -562,7 +562,9 @@ in + concatMapStringsSep ", " (x: x.output) primaryHeads; }) { assertion = cfg.desktopManager.default == "none" && cfg.windowManager.default == "none" -> cfg.plainX; - message = "Either the desktop manager or the window manager shouldn't be `none`! To explicitly allow this, you can also set `services.xserver.plainX` to `true`."; + message = "Either the desktop manager or the window manager shouldn't be `none`! " + + "To explicitly allow this, you can also set `services.xserver.plainX` to `true`. " + + "The `default` value looks for enabled WMs/DMs and select the first one."; } ];