2011-08-08 20:28:17 +01:00
|
|
|
{ config, pkgs, ... }:
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
with pkgs.lib;
|
2009-04-13 11:47:15 +01:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
let
|
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
dmcfg = config.services.xserver.displayManager;
|
|
|
|
cfg = dmcfg.slim;
|
2009-01-25 15:49:08 +00:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
slimConfig = pkgs.writeText "slim.cfg"
|
|
|
|
''
|
|
|
|
xauth_path ${dmcfg.xauthBin}
|
|
|
|
default_xserver ${dmcfg.xserverBin}
|
|
|
|
xserver_arguments ${dmcfg.xserverArgs}
|
2009-09-13 14:40:06 +01:00
|
|
|
sessions ${pkgs.lib.concatStringsSep "," (dmcfg.session.names ++ ["custom"])}
|
2010-08-07 12:16:06 +01:00
|
|
|
login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session"
|
2009-11-06 09:36:35 +00:00
|
|
|
halt_cmd ${config.system.build.upstart}/sbin/shutdown -h now
|
|
|
|
reboot_cmd ${config.system.build.upstart}/sbin/shutdown -r now
|
2009-08-16 15:49:14 +01:00
|
|
|
${if cfg.defaultUser != "" then "default_user " + cfg.defaultUser else ""}
|
|
|
|
${if cfg.hideCursor then "hidecursor true" else ""}
|
|
|
|
'';
|
2009-01-25 15:49:08 +00:00
|
|
|
|
|
|
|
# Unpack the SLiM theme, or use the default.
|
|
|
|
slimThemesDir =
|
|
|
|
let
|
|
|
|
unpackedTheme = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "slim-theme";
|
|
|
|
buildCommand = ''
|
|
|
|
ensureDir $out
|
|
|
|
cd $out
|
|
|
|
unpackFile ${cfg.theme}
|
|
|
|
ln -s * default
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
services.xserver.displayManager.slim = {
|
2011-09-14 19:20:50 +01:00
|
|
|
|
2009-08-16 15:49:14 +01:00
|
|
|
enable = mkOption {
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Whether to enable SLiM as the display manager.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
theme = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = pkgs.fetchurl {
|
|
|
|
url = http://download.berlios.de/slim/slim-wave.tar.gz;
|
|
|
|
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
|
|
|
|
};
|
|
|
|
description = ''
|
|
|
|
The theme for the SLiM login manager. If not specified, SLiM's
|
|
|
|
default theme is used. See <link
|
|
|
|
xlink:href='http://slim.berlios.de/themes01.php'/> for a
|
|
|
|
collection of themes.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultUser = mkOption {
|
|
|
|
default = "";
|
|
|
|
example = "login";
|
|
|
|
description = ''
|
|
|
|
The default user to load. If you put a username here you
|
|
|
|
get it automatically loaded into the username field, and
|
|
|
|
the focus is placed on the password.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
hideCursor = mkOption {
|
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = ''
|
|
|
|
Hide the mouse cursor on the login screen.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.xserver.displayManager.job =
|
2009-09-10 13:37:33 +01:00
|
|
|
{ preStart =
|
2009-08-16 15:49:14 +01:00
|
|
|
''
|
2009-01-25 15:49:08 +00:00
|
|
|
rm -f /var/log/slim.log
|
|
|
|
'';
|
2009-09-10 13:37:33 +01:00
|
|
|
environment =
|
|
|
|
{ SLIM_CFGFILE = slimConfig;
|
|
|
|
SLIM_THEMESDIR = slimThemesDir;
|
|
|
|
};
|
2010-06-01 20:44:23 +01:00
|
|
|
execCmd = "exec ${pkgs.slim}/bin/slim";
|
2009-01-25 15:49:08 +00:00
|
|
|
};
|
|
|
|
|
2009-10-15 15:41:59 +01:00
|
|
|
# Allow null passwords so that the user can login as root on the
|
|
|
|
# installation CD.
|
2011-08-15 15:48:32 +01:00
|
|
|
security.pam.services = [ { name = "slim"; allowNullPassword = true; } ];
|
2009-08-16 15:49:14 +01:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
};
|
2009-08-16 15:49:14 +01:00
|
|
|
|
2009-01-25 15:49:08 +00:00
|
|
|
}
|