2014-04-14 15:26:48 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-04-13 11:55:41 +01:00
|
|
|
|
2014-04-14 15:26:48 +01:00
|
|
|
with lib;
|
2009-04-13 11:55:41 +01:00
|
|
|
|
|
|
|
let
|
2009-08-16 15:49:14 +01:00
|
|
|
|
|
|
|
dmcfg = config.services.xserver.displayManager;
|
2009-04-13 11:55:41 +01:00
|
|
|
cfg = dmcfg.kdm;
|
|
|
|
|
2009-09-13 12:09:58 +01:00
|
|
|
inherit (pkgs.kde4) kdebase_workspace;
|
2009-04-13 11:55:41 +01:00
|
|
|
|
2009-09-02 19:35:23 +01: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 22:51:47 +01:00
|
|
|
${optionalString (config.system.boot.loader.id == "grub") ''
|
2011-07-17 11:52:40 +01:00
|
|
|
BootManager=${if config.boot.loader.grub.version == 2 then "Grub2" else "Grub"}
|
2009-09-13 16:03:07 +01:00
|
|
|
''}
|
2009-09-02 19:35:23 +01:00
|
|
|
|
|
|
|
[X-*-Core]
|
|
|
|
Xrdb=${pkgs.xlibs.xrdb}/bin/xrdb
|
|
|
|
SessionsDirs=${dmcfg.session.desktops}
|
2009-09-13 14:34:52 +01:00
|
|
|
Session=${dmcfg.session.script}
|
2009-09-02 19:35:23 +01:00
|
|
|
FailsafeClient=${pkgs.xterm}/bin/xterm
|
|
|
|
|
|
|
|
[X-:*-Core]
|
|
|
|
ServerCmd=${dmcfg.xserverBin} ${dmcfg.xserverArgs}
|
2010-08-08 15:05:32 +01: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 16:58:39 +01: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 19:35:23 +01: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 19:20:50 +01:00
|
|
|
|
2009-10-23 11:54:35 +01:00
|
|
|
${optionalString (cfg.enableXDMCP)
|
|
|
|
''
|
|
|
|
[Xdmcp]
|
2011-09-14 19:20:50 +01:00
|
|
|
Enable=true
|
2009-10-23 11:54:35 +01:00
|
|
|
''}
|
2009-09-02 19:35:23 +01:00
|
|
|
'';
|
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
kdmrc = pkgs.stdenv.mkDerivation {
|
2009-04-13 11:55:41 +01:00
|
|
|
name = "kdmrc";
|
2009-09-02 19:35:23 +01:00
|
|
|
config = defaultConfig + cfg.extraConfig;
|
|
|
|
buildCommand =
|
|
|
|
''
|
|
|
|
echo "$config" > $out
|
2011-10-27 16:43:13 +01: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 19:35:23 +01:00
|
|
|
'';
|
2009-04-13 11:55:41 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
options = {
|
2009-04-13 11:55:41 +01:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
services.xserver.displayManager.kdm = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
enable = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.bool;
|
2009-08-16 15:49:14 +01:00
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Whether to enable the KDE display manager.
|
|
|
|
'';
|
2009-04-13 11:55:41 +01:00
|
|
|
};
|
2009-09-02 19:35:23 +01:00
|
|
|
|
2009-10-23 11:54:35 +01:00
|
|
|
enableXDMCP = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.bool;
|
2009-10-23 11:54:35 +01:00
|
|
|
default = false;
|
2010-06-01 20:44:23 +01: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 20:44:23 +01:00
|
|
|
'';
|
2009-10-23 11:54:35 +01:00
|
|
|
};
|
|
|
|
|
2009-09-02 19:35:23 +01:00
|
|
|
extraConfig = mkOption {
|
2013-10-30 16:37:45 +00:00
|
|
|
type = types.lines;
|
2009-09-02 19:35:23 +01:00
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Options appended to <filename>kdmrc</filename>, the
|
|
|
|
configuration file of KDM.
|
|
|
|
'';
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-04-13 11:55:41 +01:00
|
|
|
};
|
2009-08-16 15:49:14 +01:00
|
|
|
|
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
###### implementation
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
config = mkIf cfg.enable {
|
2010-08-08 13:39:00 +01:00
|
|
|
|
|
|
|
services.xserver.displayManager.slim.enable = false;
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
services.xserver.displayManager.job =
|
2013-10-28 00:14:16 +00:00
|
|
|
{ execCmd =
|
2011-07-17 11:52:40 +01:00
|
|
|
''
|
2011-07-18 13:36:46 +01:00
|
|
|
mkdir -m 0755 -p /var/lib/kdm
|
|
|
|
chown kdm /var/lib/kdm
|
2013-08-06 14:13:20 +01:00
|
|
|
${(optionalString (config.system.boot.loader.id == "grub" && config.system.build.grub != null) "PATH=${config.system.build.grub}/sbin:$PATH ") +
|
2012-07-16 16:27:59 +01:00
|
|
|
"KDEDIRS=/run/current-system/sw exec ${kdebase_workspace}/bin/kdm -config ${kdmrc} -nodaemon"}
|
2011-07-17 11:52:40 +01:00
|
|
|
'';
|
2009-09-13 14:34:52 +01:00
|
|
|
logsXsession = true;
|
2009-08-16 15:49:14 +01:00
|
|
|
};
|
|
|
|
|
2013-10-15 13:47:51 +01:00
|
|
|
security.pam.services.kde = { allowNullPassword = true; startSession = true; };
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2010-11-24 10:45:34 +00:00
|
|
|
users.extraUsers = singleton
|
|
|
|
{ name = "kdm";
|
|
|
|
uid = config.ids.uids.kdm;
|
2011-07-17 11:52:40 +01:00
|
|
|
description = "KDM user";
|
2010-11-24 10:45:34 +00:00
|
|
|
};
|
|
|
|
|
2015-01-25 18:48:10 +00:00
|
|
|
environment.systemPackages =
|
|
|
|
[ pkgs.kde4.kde_wallpapers ]; # contains kdm's default background
|
|
|
|
|
2009-04-13 11:55:41 +01:00
|
|
|
};
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-04-13 11:55:41 +01:00
|
|
|
}
|