slim: Work around broken PAM session handling

Previously logging in via SLiM more than once didn't work because SLiM
doesn't clean up its PAM session properly (that is, in a child rather
than in the parent). Thus the slim process becomes part of the user
session's cgroup, among other things. This patch causes SLiM to exit
after the session has finished, after which systemd will restart
display-manager.service.

Fixes NixOS/nixops#137.

+22
+5
nixos/modules/services/x11/xserver.nix
··· 527 ''; 528 529 script = "${cfg.displayManager.job.execCmd}"; 530 }; 531 532 services.xserver.displayManager.xserverArgs =
··· 527 ''; 528 529 script = "${cfg.displayManager.job.execCmd}"; 530 + 531 + serviceConfig = { 532 + Restart = "always"; 533 + RestartSec = "200ms"; 534 + }; 535 }; 536 537 services.xserver.displayManager.xserverArgs =
+5
pkgs/applications/display-managers/slim/default.nix
··· 13 [ # Allow the paths of the configuration file and theme directory to 14 # be set at runtime. 15 ./runtime-paths.patch 16 ]; 17 18 preConfigure = "substituteInPlace CMakeLists.txt --replace /etc $out/etc --replace /lib $out/lib";
··· 13 [ # Allow the paths of the configuration file and theme directory to 14 # be set at runtime. 15 ./runtime-paths.patch 16 + 17 + # Exit after the user's session has finished. This works around 18 + # slim's broken PAM session handling (see 19 + # http://developer.berlios.de/bugs/?func=detailbug&bug_id=19102&group_id=2663). 20 + ./run-once.patch 21 ]; 22 23 preConfigure = "substituteInPlace CMakeLists.txt --replace /etc $out/etc --replace /lib $out/lib";
+12
pkgs/applications/display-managers/slim/run-once.patch
···
··· 1 + diff -ru -x '*~' slim-1.3.6-orig/app.cpp slim-1.3.6/app.cpp 2 + --- slim-1.3.6-orig/app.cpp 2013-10-15 11:02:55.629263422 +0200 3 + +++ slim-1.3.6/app.cpp 2013-10-15 13:00:10.141210784 +0200 4 + @@ -816,7 +822,7 @@ 5 + StopServer(); 6 + RemoveLock(); 7 + while (waitpid(-1, NULL, WNOHANG) > 0); /* Collects all dead childrens */ 8 + - Run(); 9 + + exit(OK_EXIT); 10 + } 11 + 12 + void App::KillAllClients(Bool top) {