Author: eelco
Date: Sun Aug  8 14:05:32 2010
New Revision: 23036
URL: https://svn.nixos.org/websvn/nix/?rev=23036&sc=1

Log:
* Change the default desktop manager from "xterm" to the last imported
  and enabled desktop manager (e.g. "kde" if KDE is enabled, and
  "xterm" if nothing is explicitly enabled).  This means that you
  don't have to write

    services.xserver.desktopManager.default = "kde4";

  anymore in addition to

    services.xserver.desktopManager.kde4.enable = true;

  to make KDE the default desktop environment.
  
* Remove the "none + none" session type.

* Remove the "+ none" string at the end of session types.  I.e. now
  it's "kde", not "kde + none".

* In kdm, add coreutils to its SystemPath so that it can remove the
  temporary directories in /tmp that it creates.

Modified:
   nixos/trunk/modules/module-list.nix
   nixos/trunk/modules/services/x11/desktop-managers/default.nix
   nixos/trunk/modules/services/x11/display-managers/default.nix
   nixos/trunk/modules/services/x11/display-managers/kdm.nix

Modified: nixos/trunk/modules/module-list.nix
==============================================================================
--- nixos/trunk/modules/module-list.nix Sun Aug  8 13:57:21 2010        (r23035)
+++ nixos/trunk/modules/module-list.nix Sun Aug  8 14:05:32 2010        (r23036)
@@ -117,10 +117,6 @@
   ./services/web-servers/jboss.nix
   ./services/web-servers/tomcat.nix
   ./services/x11/desktop-managers/default.nix
-  ./services/x11/desktop-managers/gnome.nix
-  ./services/x11/desktop-managers/kde4.nix
-  ./services/x11/desktop-managers/none.nix
-  ./services/x11/desktop-managers/xterm.nix
   ./services/x11/display-managers/default.nix
   ./services/x11/display-managers/auto.nix
   ./services/x11/display-managers/kdm.nix

Modified: nixos/trunk/modules/services/x11/desktop-managers/default.nix
==============================================================================
--- nixos/trunk/modules/services/x11/desktop-managers/default.nix       Sun Aug 
 8 13:57:21 2010        (r23035)
+++ nixos/trunk/modules/services/x11/desktop-managers/default.nix       Sun Aug 
 8 14:05:32 2010        (r23036)
@@ -1,22 +1,23 @@
-{pkgs, config, ...}:
+{ config, pkgs, ... }:
+
+with pkgs.lib;
 
 let
-  inherit (pkgs.lib) mkOption mergeOneOption mkIf filter optionalString any;
+
   xcfg = config.services.xserver;
   cfg = xcfg.desktopManager;
 
   # Whether desktop manager `d' is capable of setting a background.
   # If it isn't, the `feh' program is used as a fallback.
   needBGCond = d: ! (d ? bgSupport && d.bgSupport);
+  
 in
 
 {
-  imports = [
-    ./kde4.nix
-    ./gnome.nix
-    ./xterm.nix
-    ./none.nix
-  ];
+  # Note: the order in which desktop manager modules are imported here
+  # determines the default: later modules (if enabled) are preferred.
+  # E.g., if KDE is enabled, it supersedes xterm.
+  imports = [ ./none.nix ./xterm.nix ./gnome.nix ./kde4.nix ];
 
   options = {
   
@@ -24,11 +25,11 @@
 
       session = mkOption {
         default = [];
-        example = [{
-          name = "kde";
-          bgSupport = true;
-          start = "...";
-        }];
+        example = singleton
+          { name = "kde";
+            bgSupport = true;
+            start = "...";
+          };
         description = "
           Internal option used to add some common line to desktop manager
           scripts before forwarding the value to the
@@ -48,16 +49,15 @@
         };
       };
 
-
       default = mkOption {
-        default = "xterm";
+        default = "";
         example = "none";
-        description = "
-          Default desktop manager loaded if none have been chosen.
-        ";
+        description = "Default desktop manager loaded if none have been 
chosen.";
         merge = mergeOneOption;
         apply = defaultDM:
-          if any (w: w.name == defaultDM) cfg.session.list then
+          if defaultDM == "" && cfg.session.list != [] then
+            (head cfg.session.list).name
+          else if any (w: w.name == defaultDM) cfg.session.list then
             defaultDM
           else
             throw "Default desktop manager ($(defaultDM)) not found.";

Modified: nixos/trunk/modules/services/x11/display-managers/default.nix
==============================================================================
--- nixos/trunk/modules/services/x11/display-managers/default.nix       Sun Aug 
 8 13:57:21 2010        (r23035)
+++ nixos/trunk/modules/services/x11/display-managers/default.nix       Sun Aug 
 8 14:05:32 2010        (r23036)
@@ -23,7 +23,7 @@
 
       # The first argument of this script is the session type.
       sessionType="$1"
-      if test "$sessionType" = default; then sessionType=""; fi
+      if [ "$sessionType" = default ]; then sessionType=""; fi
 
       ${optionalString (!cfg.displayManager.job.logsXsession) ''
         exec > ~/.xsession-errors 2>&1
@@ -180,7 +180,9 @@
         apply = list: rec {
           wm = filter (s: s.manage == "window") list;
           dm = filter (s: s.manage == "desktop") list;
-          names = concatMap (d: map (w: d.name + " + " + w.name) wm) dm;
+          names = flip concatMap dm
+            (d: map (w: d.name + optionalString (w.name != "none") (" + " + 
w.name))
+              (filter (w: d.name != "none" || w.name != "none") wm));
           desktops = mkDesktops names;
           script = xsession wm dm;
         };

Modified: nixos/trunk/modules/services/x11/display-managers/kdm.nix
==============================================================================
--- nixos/trunk/modules/services/x11/display-managers/kdm.nix   Sun Aug  8 
13:57:21 2010        (r23035)
+++ nixos/trunk/modules/services/x11/display-managers/kdm.nix   Sun Aug  8 
14:05:32 2010        (r23036)
@@ -26,6 +26,8 @@
 
       [X-:*-Core]
       ServerCmd=${dmcfg.xserverBin} ${dmcfg.xserverArgs}
+      # KDM calls `rm' somewhere to clean up some temporary directory.
+      SystemPath=${pkgs.coreutils}/bin
       # The default timeout (15) is too short in a heavily loaded boot process.
       ServerTimeout=60
       # Needed to prevent the X server from dying on logout and not coming 
back:
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to