2015-11-28 09:55:46 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
dmcfg = config.services.xserver.displayManager;
|
|
|
|
ldmcfg = dmcfg.lightdm;
|
|
|
|
cfg = ldmcfg.greeters.gtk;
|
|
|
|
|
|
|
|
inherit (pkgs) stdenv lightdm writeScript writeText;
|
|
|
|
|
2015-11-28 12:06:40 +00:00
|
|
|
theme = cfg.theme.package;
|
|
|
|
icons = cfg.iconTheme.package;
|
2015-11-28 09:55:46 +00:00
|
|
|
|
|
|
|
# The default greeter provided with this expression is the GTK greeter.
|
|
|
|
# Again, we need a few things in the environment for the greeter to run with
|
|
|
|
# fonts/icons.
|
2016-09-27 14:26:37 +01:00
|
|
|
wrappedGtkGreeter = pkgs.runCommand "lightdm-gtk-greeter"
|
|
|
|
{ buildInputs = [ pkgs.makeWrapper ]; }
|
|
|
|
''
|
2015-11-28 09:55:46 +00:00
|
|
|
# This wrapper ensures that we actually get themes
|
|
|
|
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
|
|
|
|
$out/greeter \
|
2015-12-11 17:31:00 +00:00
|
|
|
--prefix PATH : "${pkgs.glibc.bin}/bin" \
|
|
|
|
--set GDK_PIXBUF_MODULE_FILE "${pkgs.gdk_pixbuf.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" \
|
|
|
|
--set GTK_PATH "${theme}:${pkgs.gtk3.out}" \
|
2015-11-28 09:55:46 +00:00
|
|
|
--set GTK_EXE_PREFIX "${theme}" \
|
|
|
|
--set GTK_DATA_PREFIX "${theme}" \
|
|
|
|
--set XDG_DATA_DIRS "${theme}/share:${icons}/share" \
|
|
|
|
--set XDG_CONFIG_HOME "${theme}/share"
|
|
|
|
|
|
|
|
cat - > $out/lightdm-gtk-greeter.desktop << EOF
|
|
|
|
[Desktop Entry]
|
|
|
|
Name=LightDM Greeter
|
|
|
|
Comment=This runs the LightDM Greeter
|
|
|
|
Exec=$out/greeter
|
|
|
|
Type=Application
|
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
|
|
|
gtkGreeterConf = writeText "lightdm-gtk-greeter.conf"
|
|
|
|
''
|
|
|
|
[greeter]
|
2015-11-28 12:06:40 +00:00
|
|
|
theme-name = ${cfg.theme.name}
|
|
|
|
icon-theme-name = ${cfg.iconTheme.name}
|
2015-11-28 09:55:46 +00:00
|
|
|
background = ${ldmcfg.background}
|
|
|
|
'';
|
|
|
|
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
2015-11-28 12:06:40 +00:00
|
|
|
|
2015-11-28 09:55:46 +00:00
|
|
|
services.xserver.displayManager.lightdm.greeters.gtk = {
|
|
|
|
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = true;
|
|
|
|
description = ''
|
|
|
|
Whether to enable lightdm-gtk-greeter as the lightdm greeter.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2015-11-28 12:06:40 +00:00
|
|
|
theme = {
|
|
|
|
|
|
|
|
package = mkOption {
|
2016-01-17 18:34:55 +00:00
|
|
|
type = types.package;
|
2015-11-28 12:06:40 +00:00
|
|
|
default = pkgs.gnome3.gnome_themes_standard;
|
2016-01-17 18:34:55 +00:00
|
|
|
defaultText = "pkgs.gnome3.gnome_themes_standard";
|
2015-11-28 12:06:40 +00:00
|
|
|
description = ''
|
|
|
|
The package path that contains the theme given in the name option.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "Adwaita";
|
|
|
|
description = ''
|
|
|
|
Name of the theme to use for the lightdm-gtk-greeter.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
iconTheme = {
|
|
|
|
|
|
|
|
package = mkOption {
|
2016-01-17 18:34:55 +00:00
|
|
|
type = types.package;
|
2015-11-28 12:06:40 +00:00
|
|
|
default = pkgs.gnome3.defaultIconTheme;
|
2016-01-17 18:34:55 +00:00
|
|
|
defaultText = "pkgs.gnome3.defaultIconTheme";
|
2015-11-28 12:06:40 +00:00
|
|
|
description = ''
|
|
|
|
The package path that contains the icon theme given in the name option.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "Adwaita";
|
|
|
|
description = ''
|
|
|
|
Name of the icon theme to use for the lightdm-gtk-greeter.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2015-11-28 09:55:46 +00:00
|
|
|
};
|
2015-11-28 12:06:40 +00:00
|
|
|
|
2015-11-28 09:55:46 +00:00
|
|
|
};
|
|
|
|
|
2015-11-30 19:03:15 +00:00
|
|
|
config = mkIf (ldmcfg.enable && cfg.enable) {
|
2015-11-28 09:55:46 +00:00
|
|
|
|
|
|
|
services.xserver.displayManager.lightdm.greeter = mkDefault {
|
|
|
|
package = wrappedGtkGreeter;
|
|
|
|
name = "lightdm-gtk-greeter";
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.etc."lightdm/lightdm-gtk-greeter.conf".source = gtkGreeterConf;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|