2009-01-25 16:49:08 +01:00
|
|
|
{pkgs, config, ...}:
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
let
|
|
|
|
inherit (pkgs.lib) mkOption;
|
|
|
|
|
2009-04-13 12:47:15 +02:00
|
|
|
slimOptions = {
|
2009-01-25 16:49:08 +01:00
|
|
|
|
2009-04-13 12:47:15 +02:00
|
|
|
theme = mkOption {
|
|
|
|
default = null;
|
|
|
|
example = pkgs.fetchurl {
|
|
|
|
url = http://download.berlios.de/slim/slim-wave.tar.gz;
|
|
|
|
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
2009-04-13 12:47:15 +02:00
|
|
|
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.
|
|
|
|
";
|
|
|
|
};
|
2009-01-25 16:49:08 +01:00
|
|
|
|
2009-04-13 12:47:15 +02:00
|
|
|
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.
|
|
|
|
";
|
|
|
|
};
|
2009-01-25 16:49:08 +01:00
|
|
|
|
2009-04-13 12:47:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
options = { services = { xserver = { displayManager = {
|
|
|
|
|
|
|
|
slim = slimOptions // {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
default = true;
|
2009-01-25 16:49:08 +01:00
|
|
|
description = "
|
2009-04-13 12:47:15 +02:00
|
|
|
Whether to enable slim as the display manager.
|
2009-01-25 16:49:08 +01:00
|
|
|
";
|
|
|
|
};
|
2009-04-13 12:47:15 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}; /* displayManager */ }; /* xserver */ }; /* services */ };
|
|
|
|
|
|
|
|
copyOldOptions = { services = { xserver = {
|
|
|
|
|
|
|
|
# Declare old options.
|
|
|
|
slim = slimOptions;
|
|
|
|
|
|
|
|
# Copy the old options into the new options.
|
|
|
|
displayManager = {
|
|
|
|
slim = config.services.xserver.slim;
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}; /* xserver */ }; /* services */ };
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
let
|
|
|
|
xcfg = config.services.xserver;
|
|
|
|
dmcfg = xcfg.displayManager;
|
2009-04-13 12:47:15 +02:00
|
|
|
cfg = dmcfg.slim;
|
|
|
|
|
|
|
|
inherit (pkgs.lib) mkIf;
|
2009-01-25 16:49:08 +01:00
|
|
|
|
|
|
|
slimConfig = pkgs.writeText "slim.cfg" ''
|
|
|
|
xauth_path ${dmcfg.xauthBin}
|
|
|
|
default_xserver ${dmcfg.xserverBin}
|
|
|
|
xserver_arguments ${dmcfg.xserverArgs}
|
|
|
|
sessions ${pkgs.lib.concatStringsSep "," dmcfg.session.names}
|
|
|
|
login_cmd exec ${pkgs.stdenv.bash}/bin/sh ${dmcfg.session.script} "%session"
|
|
|
|
halt_cmd ${pkgs.upstart}/sbin/shutdown -h now
|
|
|
|
reboot_cmd ${pkgs.upstart}/sbin/shutdown -r now
|
|
|
|
${if cfg.defaultUser != "" then "default_user " + cfg.defaultUser else ""}
|
|
|
|
${if cfg.hideCursor then "hidecursor true" else ""}
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
|
|
# 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-04-13 12:47:15 +02:00
|
|
|
mkIf cfg.enable {
|
2009-01-25 16:49:08 +01:00
|
|
|
require = [
|
|
|
|
options
|
2009-04-13 12:47:15 +02:00
|
|
|
copyOldOptions
|
2009-01-25 16:49:08 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
services = {
|
|
|
|
xserver = {
|
|
|
|
displayManager = {
|
|
|
|
job = {
|
|
|
|
beforeScript = ''
|
|
|
|
rm -f /var/log/slim.log
|
|
|
|
'';
|
|
|
|
env = ''
|
|
|
|
env SLIM_CFGFILE=${slimConfig}
|
|
|
|
env SLIM_THEMESDIR=${slimThemesDir}
|
|
|
|
'';
|
|
|
|
execCmd = "${pkgs.slim}/bin/slim";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment = {
|
|
|
|
etc = [
|
2009-05-25 01:13:23 +02:00
|
|
|
{ source = ./slim.pam;
|
2009-01-25 16:49:08 +01:00
|
|
|
target = "pam.d/slim";
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|