2011-07-17 12:52:40 +02:00
|
|
|
{ config, pkgs, ... }:
|
2009-04-13 12:55:41 +02:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
with pkgs.lib;
|
2009-04-13 12:55:41 +02:00
|
|
|
|
|
|
|
let
|
2009-08-16 16:49:14 +02:00
|
|
|
|
|
|
|
dmcfg = config.services.xserver.displayManager;
|
2009-04-13 12:55:41 +02:00
|
|
|
cfg = dmcfg.kdm;
|
|
|
|
|
2009-09-13 13:09:58 +02:00
|
|
|
inherit (pkgs.kde4) kdebase_workspace;
|
2009-04-13 12:55:41 +02:00
|
|
|
|
2009-09-02 20:35:23 +02:00
|
|
|
defaultConfig =
|
|
|
|
''
|
|
|
|
[Shutdown]
|
2013-01-16 13:17:57 +01:00
|
|
|
HaltCmd=${config.systemd.package}/sbin/shutdown -h now
|
|
|
|
RebootCmd=${config.systemd.package}/sbin/shutdown -r now
|
2009-09-27 23:51:47 +02:00
|
|
|
${optionalString (config.system.boot.loader.id == "grub") ''
|
2011-07-17 12:52:40 +02:00
|
|
|
BootManager=${if config.boot.loader.grub.version == 2 then "Grub2" else "Grub"}
|
2009-09-13 17:03:07 +02:00
|
|
|
''}
|
2009-09-02 20:35:23 +02:00
|
|
|
|
|
|
|
[X-*-Core]
|
|
|
|
Xrdb=${pkgs.xlibs.xrdb}/bin/xrdb
|
|
|
|
SessionsDirs=${dmcfg.session.desktops}
|
2009-09-13 15:34:52 +02:00
|
|
|
Session=${dmcfg.session.script}
|
2009-09-02 20:35:23 +02:00
|
|
|
FailsafeClient=${pkgs.xterm}/bin/xterm
|
|
|
|
|
|
|
|
[X-:*-Core]
|
|
|
|
ServerCmd=${dmcfg.xserverBin} ${dmcfg.xserverArgs}
|
2010-08-08 16:05:32 +02:00
|
|
|
# KDM calls `rm' somewhere to clean up some temporary directory.
|
|
|
|
SystemPath=${pkgs.coreutils}/bin
|
2009-11-07 12:32:28 +01:00
|
|
|
# The default timeout (15) is too short in a heavily loaded boot process.
|
|
|
|
ServerTimeout=60
|
2009-09-10 17:58:39 +02:00
|
|
|
# Needed to prevent the X server from dying on logout and not coming back:
|
|
|
|
TerminateServer=true
|
2013-02-15 13:48:34 +01:00
|
|
|
${optionalString (cfg.setupScript != "")
|
|
|
|
''
|
|
|
|
Setup=${cfg.setupScript}
|
|
|
|
''}
|
2009-09-02 20:35:23 +02:00
|
|
|
|
|
|
|
[X-*-Greeter]
|
|
|
|
HiddenUsers=root,nixbld1,nixbld2,nixbld3,nixbld4,nixbld5,nixbld6,nixbld7,nixbld8,nixbld9,nixbld10
|
|
|
|
PluginsLogin=${kdebase_workspace}/lib/kde4/kgreet_classic.so
|
2013-02-15 13:48:34 +01:00
|
|
|
${optionalString (cfg.themeDirectory != "")
|
|
|
|
''
|
|
|
|
UseTheme=true
|
|
|
|
Theme=${cfg.themeDirectory}
|
|
|
|
''
|
|
|
|
}
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-10-23 12:54:35 +02:00
|
|
|
${optionalString (cfg.enableXDMCP)
|
|
|
|
''
|
|
|
|
[Xdmcp]
|
2011-09-14 20:20:50 +02:00
|
|
|
Enable=true
|
2009-10-23 12:54:35 +02:00
|
|
|
''}
|
2009-09-02 20:35:23 +02:00
|
|
|
'';
|
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
kdmrc = pkgs.stdenv.mkDerivation {
|
2009-04-13 12:55:41 +02:00
|
|
|
name = "kdmrc";
|
2009-09-02 20:35:23 +02:00
|
|
|
config = defaultConfig + cfg.extraConfig;
|
|
|
|
buildCommand =
|
|
|
|
''
|
|
|
|
echo "$config" > $out
|
2011-10-27 17:43:13 +02:00
|
|
|
|
|
|
|
# The default kdmrc would add "-nolisten tcp", and we already
|
|
|
|
# have that managed by nixos. Hence the grep.
|
|
|
|
cat ${kdebase_workspace}/share/config/kdm/kdmrc | grep -v nolisten >> $out
|
2009-09-02 20:35:23 +02:00
|
|
|
'';
|
2009-04-13 12:55:41 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
options = {
|
2009-04-13 12:55:41 +02:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
services.xserver.displayManager.kdm = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable the KDE display manager.
|
|
|
|
'';
|
2009-04-13 12:55:41 +02:00
|
|
|
};
|
2009-09-02 20:35:23 +02:00
|
|
|
|
2009-10-23 12:54:35 +02:00
|
|
|
enableXDMCP = mkOption {
|
|
|
|
default = false;
|
2010-06-01 21:44:23 +02:00
|
|
|
description = ''
|
|
|
|
Whether to enable XDMCP, which allows remote logins.
|
2013-02-15 13:48:34 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
themeDirectory = mkOption {
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
The path to a KDM theme directory. This theme
|
|
|
|
will be used by the KDM greeter.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
setupScript = mkOption {
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
The path to a KDM setup script. This script is run as root just
|
|
|
|
before KDM starts. Can be used for setting up
|
|
|
|
monitors with xrandr, for example.
|
2010-06-01 21:44:23 +02:00
|
|
|
'';
|
2009-10-23 12:54:35 +02:00
|
|
|
};
|
|
|
|
|
2009-09-02 20:35:23 +02:00
|
|
|
extraConfig = mkOption {
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Options appended to <filename>kdmrc</filename>, the
|
|
|
|
configuration file of KDM.
|
|
|
|
'';
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-04-13 12:55:41 +02:00
|
|
|
};
|
2009-08-16 16:49:14 +02:00
|
|
|
|
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
###### implementation
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
config = mkIf cfg.enable {
|
2010-08-08 14:39:00 +02:00
|
|
|
|
|
|
|
services.xserver.displayManager.slim.enable = false;
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
services.xserver.displayManager.job =
|
2010-07-05 16:33:11 +02:00
|
|
|
{ execCmd =
|
2011-07-17 12:52:40 +02:00
|
|
|
''
|
2011-07-18 14:36:46 +02:00
|
|
|
mkdir -m 0755 -p /var/lib/kdm
|
|
|
|
chown kdm /var/lib/kdm
|
2011-07-17 12:52:40 +02:00
|
|
|
${(optionalString (config.system.boot.loader.id == "grub") "PATH=${config.system.build.grub}/sbin:$PATH ") +
|
2012-07-16 17:27:59 +02:00
|
|
|
"KDEDIRS=/run/current-system/sw exec ${kdebase_workspace}/bin/kdm -config ${kdmrc} -nodaemon"}
|
2011-07-17 12:52:40 +02:00
|
|
|
'';
|
2009-09-13 15:34:52 +02:00
|
|
|
logsXsession = true;
|
2009-08-16 16:49:14 +02:00
|
|
|
};
|
|
|
|
|
2012-08-17 19:48:22 +02:00
|
|
|
security.pam.services = [ { name = "kde"; allowNullPassword = true; startSession = true; } ];
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2010-11-24 11:45:34 +01:00
|
|
|
users.extraUsers = singleton
|
|
|
|
{ name = "kdm";
|
|
|
|
uid = config.ids.uids.kdm;
|
2011-07-17 12:52:40 +02:00
|
|
|
description = "KDM user";
|
2010-11-24 11:45:34 +01:00
|
|
|
};
|
|
|
|
|
2009-04-13 12:55:41 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-04-13 12:55:41 +02:00
|
|
|
}
|