Author: eelco
Date: Mon Aug  8 19:28:17 2011
New Revision: 28400
URL: https://svn.nixos.org/websvn/nix/?rev=28400&sc=1

Log:
* Some hackery to get ConsoleKit to work with the SLIM and "auto"
  display managers.  This was broken due to a change in ConsoleKit
  0.4.2:

    https://bugs.freedesktop.org/show_bug.cgi?id=28377

  Using ConsoleKit's pam-ck-connector helps in that it creates local
  sessions; however, they're not marked as active because the
  x11-display-device property is not set.  As a workaround, calling
  ck-launch-session seems to work.

  More details:

    https://bugs.gentoo.org/show_bug.cgi?id=336634
    http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=598150
    https://bugzilla.redhat.com/show_bug.cgi?id=585952

Modified:
   nixos/trunk/modules/programs/shadow.nix
   nixos/trunk/modules/services/x11/display-managers/auto.nix
   nixos/trunk/modules/services/x11/display-managers/default.nix
   nixos/trunk/modules/services/x11/display-managers/slim.nix

Modified: nixos/trunk/modules/programs/shadow.nix
==============================================================================
--- nixos/trunk/modules/programs/shadow.nix     Mon Aug  8 19:02:17 2011        
(r28399)
+++ nixos/trunk/modules/programs/shadow.nix     Mon Aug  8 19:28:17 2011        
(r28400)
@@ -75,7 +75,8 @@
     security.pam.services =
       [ { name = "chsh"; rootOK = true; }
         { name = "chfn"; rootOK = true; }
-        { name = "su"; rootOK = true; forwardXAuth = true; }
+        # Enable ‘ownDevices’ for the services/x11/display-managers/auto.nix 
module.
+        { name = "su"; rootOK = true; ownDevices = true; forwardXAuth = true; }
         { name = "passwd"; }
         # Note: useradd, groupadd etc. aren't setuid root, so it
         # doesn't really matter what the PAM config says as long as it

Modified: nixos/trunk/modules/services/x11/display-managers/auto.nix
==============================================================================
--- nixos/trunk/modules/services/x11/display-managers/auto.nix  Mon Aug  8 
19:02:17 2011        (r28399)
+++ nixos/trunk/modules/services/x11/display-managers/auto.nix  Mon Aug  8 
19:28:17 2011        (r28400)
@@ -52,6 +52,11 @@
           '';
       };
 
+    # The ConsoleKit PAM connector launches a local session, but it's
+    # not set as "active" (maybe because x11-display-device is not
+    # set).  Launching a child session seems to fix that.
+    services.xserver.displayManager.forceCKSession = true;
+    
   };
 
 }

Modified: nixos/trunk/modules/services/x11/display-managers/default.nix
==============================================================================
--- nixos/trunk/modules/services/x11/display-managers/default.nix       Mon Aug 
 8 19:02:17 2011        (r28399)
+++ nixos/trunk/modules/services/x11/display-managers/default.nix       Mon Aug 
 8 19:28:17 2011        (r28400)
@@ -53,8 +53,8 @@
 
       # Start a ConsoleKit session so that we get ownership of various
       # devices.
-      if test -z "$XDG_SESSION_COOKIE"; then
-          exec ${pkgs.consolekit}/bin/ck-launch-session "$0" "$sessionType"
+      if [ \( -z "$XDG_SESSION_COOKIE" -o -n "${toString 
cfg.displayManager.forceCKSession}" \) -a -z "$CK_STARTED" ]; then
+          CK_STARTED=1 exec ${pkgs.consolekit}/bin/ck-launch-session "$0" 
"$sessionType"
       fi
 
       # Handle being called by kdm.
@@ -162,6 +162,12 @@
         apply = toString;
       };
 
+      forceCKSession = mkOption {
+        internal = true;
+        default = false;
+        description = "Whether to force launching of a ConsoleKit session.";
+      };
+
       session = mkOption {
         default = [];
         example = [

Modified: nixos/trunk/modules/services/x11/display-managers/slim.nix
==============================================================================
--- nixos/trunk/modules/services/x11/display-managers/slim.nix  Mon Aug  8 
19:02:17 2011        (r28399)
+++ nixos/trunk/modules/services/x11/display-managers/slim.nix  Mon Aug  8 
19:28:17 2011        (r28400)
@@ -1,4 +1,4 @@
-{pkgs, config, ...}:
+{ config, pkgs, ... }:
 
 with pkgs.lib;
 
@@ -106,8 +106,17 @@
 
     # Allow null passwords so that the user can login as root on the
     # installation CD.
-    security.pam.services = [ { name = "slim"; allowNullPassword = true; } ];
+    security.pam.services = singleton
+      { name = "slim";
+        allowNullPassword = true;
+        ownDevices = true;
+      };
 
+    # The ConsoleKit PAM connector launches a local session, but it's
+    # not set as "active" (maybe because x11-display-device is not
+    # set).  Launching a child session seems to fix that.
+    services.xserver.displayManager.forceCKSession = true;
+    
   };
 
 }
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to