2015-11-28 09:55:46 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
dmcfg = config.services.xserver.displayManager;
|
|
|
|
ldmcfg = dmcfg.lightdm;
|
2019-01-27 16:29:11 +00:00
|
|
|
xcfg = config.services.xserver;
|
2015-11-28 09:55:46 +00:00
|
|
|
cfg = ldmcfg.greeters.gtk;
|
|
|
|
|
2018-07-20 20:36:12 +01:00
|
|
|
inherit (pkgs) writeText;
|
2015-11-28 09:55:46 +00:00
|
|
|
|
2015-11-28 12:06:40 +00:00
|
|
|
theme = cfg.theme.package;
|
|
|
|
icons = cfg.iconTheme.package;
|
2017-03-31 15:31:17 +01:00
|
|
|
cursors = cfg.cursorTheme.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.
|
2018-11-08 10:59:03 +00:00
|
|
|
wrappedGtkGreeter = pkgs.runCommand "lightdm-gtk-greeter" {
|
|
|
|
buildInputs = [ pkgs.makeWrapper ];
|
|
|
|
preferLocalBuild = true;
|
|
|
|
} ''
|
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 \
|
2018-03-28 14:46:56 +01:00
|
|
|
--prefix PATH : "${lib.getBin pkgs.stdenv.cc.libc}/bin" \
|
2018-07-12 15:26:31 +01:00
|
|
|
--set GDK_PIXBUF_MODULE_FILE "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" \
|
2015-12-11 17:31:00 +00:00
|
|
|
--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" \
|
2017-03-31 15:31:17 +01:00
|
|
|
--set XDG_CONFIG_HOME "${theme}/share" \
|
|
|
|
--set XCURSOR_PATH "${cursors}/share/icons"
|
2015-11-28 09:55:46 +00:00
|
|
|
|
|
|
|
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}
|
2017-03-31 15:31:17 +01:00
|
|
|
cursor-theme-name = ${cfg.cursorTheme.name}
|
|
|
|
cursor-theme-size = ${toString cfg.cursorTheme.size}
|
2015-11-28 09:55:46 +00:00
|
|
|
background = ${ldmcfg.background}
|
2017-12-24 13:21:18 +00:00
|
|
|
${optionalString (cfg.clock-format != null) "clock-format = ${cfg.clock-format}"}
|
|
|
|
${optionalString (cfg.indicators != null) "indicators = ${concatStringsSep ";" cfg.indicators}"}
|
2019-01-27 16:29:11 +00:00
|
|
|
${optionalString (xcfg.dpi != null) "xft-dpi=${toString xcfg.dpi}"}
|
2017-03-22 14:33:22 +00:00
|
|
|
${cfg.extraConfig}
|
2015-11-28 09:55:46 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
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;
|
2018-07-22 03:03:24 +01:00
|
|
|
default = pkgs.gnome3.gnome-themes-extra;
|
|
|
|
defaultText = "pkgs.gnome3.gnome-themes-extra";
|
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;
|
2019-02-13 21:47:50 +00:00
|
|
|
default = pkgs.gnome3.adwaita-icon-theme;
|
|
|
|
defaultText = "pkgs.gnome3.adwaita-icon-theme";
|
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.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2017-03-31 15:31:17 +01:00
|
|
|
cursorTheme = {
|
|
|
|
|
|
|
|
package = mkOption {
|
2019-02-13 21:47:50 +00:00
|
|
|
default = pkgs.gnome3.adwaita-icon-theme;
|
|
|
|
defaultText = "pkgs.gnome3.adwaita-icon-theme";
|
2017-03-31 15:31:17 +01:00
|
|
|
description = ''
|
|
|
|
The package path that contains the cursor theme given in the name option.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
name = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "Adwaita";
|
|
|
|
description = ''
|
|
|
|
Name of the cursor theme to use for the lightdm-gtk-greeter.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
size = mkOption {
|
|
|
|
type = types.int;
|
|
|
|
default = 16;
|
|
|
|
description = ''
|
|
|
|
Size of the cursor theme to use for the lightdm-gtk-greeter.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2017-12-24 13:21:18 +00:00
|
|
|
clock-format = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
example = "%F";
|
|
|
|
description = ''
|
|
|
|
Clock format string (as expected by strftime, e.g. "%H:%M")
|
|
|
|
to use with the lightdm gtk greeter panel.
|
|
|
|
|
|
|
|
If set to null the default clock format is used.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
indicators = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
default = null;
|
|
|
|
example = [ "~host" "~spacer" "~clock" "~spacer" "~session" "~language" "~a11y" "~power" ];
|
|
|
|
description = ''
|
|
|
|
List of allowed indicator modules to use for the lightdm gtk
|
|
|
|
greeter panel.
|
|
|
|
|
|
|
|
Built-in indicators include "~a11y", "~language", "~session",
|
|
|
|
"~power", "~clock", "~host", "~spacer". Unity indicators can be
|
|
|
|
represented by short name (e.g. "sound", "power"), service file name,
|
|
|
|
or absolute path.
|
|
|
|
|
|
|
|
If set to null the default indicators are used.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2017-03-22 14:33:22 +00:00
|
|
|
extraConfig = mkOption {
|
|
|
|
type = types.lines;
|
|
|
|
default = "";
|
|
|
|
description = ''
|
|
|
|
Extra configuration that should be put in the lightdm-gtk-greeter.conf
|
|
|
|
configuration file.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
};
|
|
|
|
}
|