summary refs log tree commit diff
path: root/nixos/modules/services
diff options
context:
space:
mode:
authorTim Steinbach <NeQuissimus@users.noreply.github.com>2017-11-15 16:41:52 +0000
committerGitHub <noreply@github.com>2017-11-15 16:41:52 +0000
commitc9b8bbd039ea4faae2868f3ca132455829b4e4ef (patch)
treec944c6e201f0fa58bc2c5539fd48849ffdebe298 /nixos/modules/services
parent72de80fa7932d9c3162f07713e5669890007912e (diff)
parent410f0f0db213e3d99119208e3497002caf1f9ade (diff)
downloadnixlib-c9b8bbd039ea4faae2868f3ca132455829b4e4ef.tar
nixlib-c9b8bbd039ea4faae2868f3ca132455829b4e4ef.tar.gz
nixlib-c9b8bbd039ea4faae2868f3ca132455829b4e4ef.tar.bz2
nixlib-c9b8bbd039ea4faae2868f3ca132455829b4e4ef.tar.lz
nixlib-c9b8bbd039ea4faae2868f3ca132455829b4e4ef.tar.xz
nixlib-c9b8bbd039ea4faae2868f3ca132455829b4e4ef.tar.zst
nixlib-c9b8bbd039ea4faae2868f3ca132455829b4e4ef.zip
Merge pull request #31268 from Ma27/x11-defaults
services.xserver: fix defaults of X11
Diffstat (limited to 'nixos/modules/services')
-rw-r--r--nixos/modules/services/x11/desktop-managers/default.nix6
-rw-r--r--nixos/modules/services/x11/window-managers/default.nix4
-rw-r--r--nixos/modules/services/x11/xserver.nix14
3 files changed, 20 insertions, 4 deletions
diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix
index 13f339e3fbf3..39b27d4ceb61 100644
--- a/nixos/modules/services/x11/desktop-managers/default.nix
+++ b/nixos/modules/services/x11/desktop-managers/default.nix
@@ -87,11 +87,11 @@ 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
+          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 d12003768a67..25ba95fccd75 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 d4fe475690ce..7d544e153e9a 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,11 @@ 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`. "
+                + "The `default` value looks for enabled WMs/DMs and select the first one.";
+      }
     ];
 
     environment.etc =