2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-04-13 12:55:41 +02:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with 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]
|
2015-09-15 11:26:18 +02:00
|
|
|
Xrdb=${pkgs.xorg.xrdb}/bin/xrdb
|
2009-09-02 20:35:23 +02:00
|
|
|
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]
|
2016-12-04 14:48:47 +01:00
|
|
|
ServerCmd=${dmcfg.xserverBin} ${toString 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]
|
2015-03-10 02:04:40 +01:00
|
|
|
HiddenUsers=root,${concatStringsSep "," dmcfg.hiddenUsers}
|
2009-09-02 20:35:23 +02:00
|
|
|
PluginsLogin=${kdebase_workspace}/lib/kde4/kgreet_classic.so
|
2013-10-30 17:37:45 +01:00
|
|
|
${optionalString (cfg.themeDirectory != null)
|
2013-02-15 13:48:34 +01:00
|
|
|
''
|
|
|
|
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
|
|
|
'';
|
|
|
|
|
2016-09-27 15:26:37 +02:00
|
|
|
kdmrc = pkgs.runCommand "kdmrc"
|
|
|
|
{ config = defaultConfig + cfg.extraConfig;
|
|
|
|
preferLocalBuild = true;
|
|
|
|
}
|
|
|
|
''
|
|
|
|
echo "$config" > $out
|
2011-10-27 17:43:13 +02:00
|
|
|
|
2016-09-27 15:26:37 +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-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 {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.bool;
|
2009-08-16 16:49:14 +02:00
|
|
|
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 {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.bool;
|
2009-10-23 12:54:35 +02:00
|
|
|
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 {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2013-02-15 13:48:34 +01:00
|
|
|
description = ''
|
|
|
|
The path to a KDM theme directory. This theme
|
|
|
|
will be used by the KDM greeter.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
setupScript = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.lines;
|
2013-02-15 13:48:34 +01: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 21:44:23 +02:00
|
|
|
'';
|
2009-10-23 12:54:35 +02:00
|
|
|
};
|
|
|
|
|
2009-09-02 20:35:23 +02:00
|
|
|
extraConfig = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.lines;
|
2009-09-02 20:35:23 +02:00
|
|
|
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 =
|
2013-10-28 01:14:16 +01: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
|
2013-08-06 15:13:20 +02:00
|
|
|
${(optionalString (config.system.boot.loader.id == "grub" && config.system.build.grub != null) "PATH=${config.system.build.grub}/sbin:$PATH ") +
|
2016-05-24 21:07:26 +02:00
|
|
|
"KDEDIRS=/run/current-system/sw exec ${kdebase_workspace}/bin/kdm -config ${kdmrc} -nodaemon -logfile /dev/stderr"}
|
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
|
|
|
};
|
|
|
|
|
2013-10-15 14:47:51 +02:00
|
|
|
security.pam.services.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
|
|
|
};
|
|
|
|
|
2015-01-25 19:48:10 +01:00
|
|
|
environment.systemPackages =
|
|
|
|
[ pkgs.kde4.kde_wallpapers ]; # contains kdm's default background
|
|
|
|
|
2009-04-13 12:55:41 +02:00
|
|
|
};
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-04-13 12:55:41 +02:00
|
|
|
}
|