2014-04-14 16:26:48 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2009-01-25 16:49:08 +01:00
|
|
|
|
2014-04-14 16:26:48 +02:00
|
|
|
with lib;
|
2009-04-13 12:47:15 +02:00
|
|
|
|
2009-01-25 16:49:08 +01:00
|
|
|
let
|
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
dmcfg = config.services.xserver.displayManager;
|
2014-02-05 13:44:59 +01:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
cfg = dmcfg.slim;
|
2009-01-25 16:49:08 +01:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
slimConfig = pkgs.writeText "slim.cfg"
|
|
|
|
''
|
|
|
|
xauth_path ${dmcfg.xauthBin}
|
|
|
|
default_xserver ${dmcfg.xserverBin}
|
|
|
|
xserver_arguments ${dmcfg.xserverArgs}
|
2013-10-15 13:41:03 +02:00
|
|
|
sessiondir ${dmcfg.session.desktops}
|
2010-08-07 13:16:06 +02:00
|
|
|
login_cmd exec ${pkgs.stdenv.shell} ${dmcfg.session.script} "%session"
|
2013-01-16 13:17:57 +01:00
|
|
|
halt_cmd ${config.systemd.package}/sbin/shutdown -h now
|
|
|
|
reboot_cmd ${config.systemd.package}/sbin/shutdown -r now
|
2013-10-30 17:37:45 +01:00
|
|
|
${optionalString (cfg.defaultUser != null) ("default_user " + cfg.defaultUser)}
|
2015-11-18 23:49:39 +01:00
|
|
|
${optionalString (cfg.defaultUser != null) ("focus_password yes")}
|
2012-04-13 16:52:25 +02:00
|
|
|
${optionalString cfg.autoLogin "auto_login yes"}
|
2014-08-31 03:01:55 +02:00
|
|
|
${cfg.extraConfig}
|
2009-08-16 16:49:14 +02:00
|
|
|
'';
|
2009-01-25 16:49:08 +01:00
|
|
|
|
|
|
|
# Unpack the SLiM theme, or use the default.
|
|
|
|
slimThemesDir =
|
|
|
|
let
|
|
|
|
unpackedTheme = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "slim-theme";
|
|
|
|
buildCommand = ''
|
2014-06-30 14:56:10 +02:00
|
|
|
mkdir -p $out
|
2009-01-25 16:49:08 +01:00
|
|
|
cd $out
|
|
|
|
unpackFile ${cfg.theme}
|
|
|
|
ln -s * default
|
|
|
|
'';
|
|
|
|
};
|
2014-03-30 19:32:10 +02:00
|
|
|
in if cfg.theme == null then "${pkgs.slim}/share/slim/themes" else unpackedTheme;
|
2009-01-25 16:49:08 +01:00
|
|
|
|
|
|
|
in
|
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
###### interface
|
|
|
|
|
|
|
|
options = {
|
2011-09-14 20:20:50 +02:00
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
services.xserver.displayManager.slim = {
|
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;
|
2013-10-15 17:22:30 +02:00
|
|
|
default = config.services.xserver.enable;
|
2009-08-16 16:49:14 +02:00
|
|
|
description = ''
|
|
|
|
Whether to enable SLiM as the display manager.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
theme = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.nullOr types.path;
|
2015-07-17 16:01:07 +02:00
|
|
|
default = pkgs.fetchurl {
|
2015-11-18 23:30:24 +01:00
|
|
|
url = "https://github.com/jagajaga/nixos-slim-theme/archive/2.0.tar.gz";
|
|
|
|
sha256 = "0lldizhigx7bjhxkipii87y432hlf5wdvamnfxrryf9z7zkfypc8";
|
2015-07-17 16:01:07 +02:00
|
|
|
};
|
2016-01-17 19:34:55 +01:00
|
|
|
defaultText = ''pkgs.fetchurl {
|
|
|
|
url = "https://github.com/jagajaga/nixos-slim-theme/archive/2.0.tar.gz";
|
|
|
|
sha256 = "0lldizhigx7bjhxkipii87y432hlf5wdvamnfxrryf9z7zkfypc8";
|
|
|
|
}'';
|
2013-10-30 17:37:45 +01:00
|
|
|
example = literalExample ''
|
|
|
|
pkgs.fetchurl {
|
2014-05-18 14:27:11 +02:00
|
|
|
url = "mirror://sourceforge/slim.berlios/slim-wave.tar.gz";
|
2013-10-30 17:37:45 +01:00
|
|
|
sha256 = "0ndr419i5myzcylvxb89m9grl2xyq6fbnyc3lkd711mzlmnnfxdy";
|
|
|
|
}
|
|
|
|
'';
|
2009-08-16 16:49:14 +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
|
2014-05-18 13:25:43 +02:00
|
|
|
collection of themes. TODO: berlios shut down.
|
2009-08-16 16:49:14 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
defaultUser = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
2009-08-16 16:49:14 +02:00
|
|
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2012-04-13 16:52:25 +02:00
|
|
|
autoLogin = mkOption {
|
2013-10-30 17:37:45 +01:00
|
|
|
type = types.bool;
|
2012-04-13 16:52:25 +02:00
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Automatically log in as the default user.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2014-08-31 03:01:55 +02:00
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Extra configuration options for SLiM login manager. Do not
|
|
|
|
add options that can be configured directly.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2009-08-16 16:49:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
###### implementation
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
|
|
|
|
services.xserver.displayManager.job =
|
2009-09-10 14:37:33 +02:00
|
|
|
{ preStart =
|
2009-08-16 16:49:14 +02:00
|
|
|
''
|
2009-01-25 16:49:08 +01:00
|
|
|
rm -f /var/log/slim.log
|
|
|
|
'';
|
2009-09-10 14:37:33 +02:00
|
|
|
environment =
|
|
|
|
{ SLIM_CFGFILE = slimConfig;
|
|
|
|
SLIM_THEMESDIR = slimThemesDir;
|
|
|
|
};
|
2014-03-30 19:32:10 +02:00
|
|
|
execCmd = "exec ${pkgs.slim}/bin/slim";
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
|
|
|
|
2014-03-30 19:32:10 +02:00
|
|
|
services.xserver.displayManager.sessionCommands =
|
|
|
|
''
|
|
|
|
# Export the config/themes for slimlock.
|
|
|
|
export SLIM_THEMESDIR=${slimThemesDir}
|
|
|
|
'';
|
|
|
|
|
2013-10-15 14:47:51 +02:00
|
|
|
# Allow null passwords so that the user can login as root on the
|
|
|
|
# installation CD.
|
|
|
|
security.pam.services.slim = { allowNullPassword = true; startSession = true; };
|
|
|
|
|
|
|
|
# Allow slimlock to work.
|
|
|
|
security.pam.services.slimlock = {};
|
2013-10-15 13:21:58 +02:00
|
|
|
|
2014-03-30 19:32:10 +02:00
|
|
|
environment.systemPackages = [ pkgs.slim ];
|
2009-08-16 16:49:14 +02:00
|
|
|
|
2009-01-25 16:49:08 +01:00
|
|
|
};
|
2009-08-16 16:49:14 +02:00
|
|
|
|
2009-01-25 16:49:08 +01:00
|
|
|
}
|