From 5b70c1855b9681cbbe3e7625350ce322a63572b3 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 5 Nov 2017 07:32:56 +0100 Subject: [PATCH 1/2] Revert "Revert "services.xserver: assert that either desktop- or window manager is not "none""" This reverts commit e64dc2543458b52abcd913bad87851f5d7db435d. --- nixos/doc/manual/release-notes/rl-1803.xml | 8 ++++++++ .../services/x11/desktop-managers/default.nix | 4 ++-- nixos/modules/services/x11/xserver.nix | 12 ++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/nixos/doc/manual/release-notes/rl-1803.xml b/nixos/doc/manual/release-notes/rl-1803.xml index 17b385242f6..fe776c3df22 100644 --- a/nixos/doc/manual/release-notes/rl-1803.xml +++ b/nixos/doc/manual/release-notes/rl-1803.xml @@ -90,6 +90,14 @@ following incompatible changes: That means that old configuration is not overwritten by default when update to the znc options are made. + + + The option is now none by default. + An assertion failure is thrown if WM's and DM's default are none. + To explicitly run a plain X session without and DM or WM, the newly introduced option + must be set to true. + + diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix index 13f339e3fbf..b393167ae2c 100644 --- a/nixos/modules/services/x11/desktop-managers/default.nix +++ b/nixos/modules/services/x11/desktop-managers/default.nix @@ -87,8 +87,8 @@ in default = mkOption { type = types.str; - default = ""; - example = "none"; + default = "none"; + example = "plasma5"; description = "Default desktop manager loaded if none have been chosen."; apply = defaultDM: if defaultDM == "" && cfg.session.list != [] then diff --git a/nixos/modules/services/x11/xserver.nix b/nixos/modules/services/x11/xserver.nix index d4fe475690c..58dc75bcb4e 100644 --- a/nixos/modules/services/x11/xserver.nix +++ b/nixos/modules/services/x11/xserver.nix @@ -161,6 +161,15 @@ in ''; }; + plainX = mkOption { + type = types.bool; + default = false; + description = '' + Whether the X11 session can be plain (without DM/WM) and + the Xsession script will be used as fallback or not. + ''; + }; + autorun = mkOption { type = types.bool; default = true; @@ -552,6 +561,9 @@ in + "${toString (length primaryHeads)} heads set to primary: " + 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`."; + } ]; environment.etc = From 410f0f0db213e3d99119208e3497002caf1f9ade Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 5 Nov 2017 08:23:57 +0100 Subject: [PATCH 2/2] services.xserver: fix `apply` of default DM/WM This is needed to pick the first enabled DM/WM if the default is `none` --- nixos/modules/services/x11/desktop-managers/default.nix | 2 +- nixos/modules/services/x11/window-managers/default.nix | 4 +++- nixos/modules/services/x11/xserver.nix | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) 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."; } ];