From b1e05ed8fa95cd41e21b6d0e4da1c354b361c91d Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Mon, 13 Apr 2009 10:55:41 +0000 Subject: [PATCH] * Synced with trunk @ 14913 svn path=/nixos/branches/modular-nixos/; revision=15010 --- .../xserver/displayManager/default.nix | 1 + upstart-jobs/xserver/displayManager/kdm.nix | 68 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 upstart-jobs/xserver/displayManager/kdm.nix diff --git a/upstart-jobs/xserver/displayManager/default.nix b/upstart-jobs/xserver/displayManager/default.nix index 12393af8f6c6..f7734c96aaac 100644 --- a/upstart-jobs/xserver/displayManager/default.nix +++ b/upstart-jobs/xserver/displayManager/default.nix @@ -72,6 +72,7 @@ in { # list of display managers. require = [ + (import ./kdm.nix) (import ./slim.nix) ]; diff --git a/upstart-jobs/xserver/displayManager/kdm.nix b/upstart-jobs/xserver/displayManager/kdm.nix new file mode 100644 index 000000000000..38ab01c4c3c4 --- /dev/null +++ b/upstart-jobs/xserver/displayManager/kdm.nix @@ -0,0 +1,68 @@ +{pkgs, config, ...}: + +###### interface +let + inherit (pkgs.lib) mkOption; + + options = { services = { xserver = { displayManager = { + + kdm = { + enable = mkOption { + default = false; + description = " + Whether to enable the KDE display manager. + "; + }; + }; + + }; /* displayManager */ }; /* xserver */ }; /* services */ }; + +in + +###### implementation +let + xcfg = config.services.xserver; + dmcfg = xcfg.displayManager; + cfg = dmcfg.kdm; + + inherit (pkgs.lib) mkIf; + inherit (pkgs) stdenv; + inherit (pkgs.kde42) kdebase_workspace; + + kdmrc = stdenv.mkDerivation { + name = "kdmrc"; + buildCommand = '' + cp ${kdebase_workspace}/share/config/kdm/kdmrc . + sed -i -e "s|#HaltCmd=|HaltCmd=${pkgs.upstart}/sbin/halt|" \ + -e "s|#RebootCmd=|RebootCmd=${pkgs.upstart}/sbin/reboot|" \ + -e "s|#Xrdb=|Xrdb=${pkgs.xlibs.xrdb}/bin/xrdb|" \ + -e "s|#HiddenUsers=root|HiddenUsers=root,nixbld1,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9,nixbld10|" \ + -e "s|ServerCmd=/FOO/bin/X|ServerCmd=${dmcfg.xserverBin} ${dmcfg.xserverArgs}|" \ + -e "s|Session=${kdebase_workspace}/share/config/kdm/Xsession|Session=${dmcfg.session.script}|" \ + -e "s|#FailsafeClient=|FailsafeClient=${pkgs.xterm}/bin/xterm|" \ + -e "s|#PluginsLogin=sign|PluginsLogin=${kdebase_workspace}/lib/kde4/kgreet_classic.so|" \ + kdmrc + ensureDir $out + cp kdmrc $out + ''; + }; + +in + +mkIf cfg.enable { + require = [ + options + ]; + + services = { + xserver = { + displayManager = { + job = { + beforeScript = ""; + env = ""; + execCmd = "${kdebase_workspace}/bin/kdm -config ${kdmrc}/kdmrc"; + }; + }; + }; + }; +}