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