Merge pull request #11336 from TimoMeijer/fix/nixos-modules-lightdm
lightdm module: Extract greeter configuration and add theme options
This commit is contained in:
commit
7f7b0dc3f2
@ -0,0 +1,121 @@
|
|||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
|
||||||
|
let
|
||||||
|
|
||||||
|
dmcfg = config.services.xserver.displayManager;
|
||||||
|
ldmcfg = dmcfg.lightdm;
|
||||||
|
cfg = ldmcfg.greeters.gtk;
|
||||||
|
|
||||||
|
inherit (pkgs) stdenv lightdm writeScript writeText;
|
||||||
|
|
||||||
|
theme = cfg.theme.package;
|
||||||
|
icons = cfg.iconTheme.package;
|
||||||
|
|
||||||
|
# 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.
|
||||||
|
wrappedGtkGreeter = stdenv.mkDerivation {
|
||||||
|
name = "lightdm-gtk-greeter";
|
||||||
|
buildInputs = [ pkgs.makeWrapper ];
|
||||||
|
|
||||||
|
buildCommand = ''
|
||||||
|
# This wrapper ensures that we actually get themes
|
||||||
|
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
|
||||||
|
$out/greeter \
|
||||||
|
--prefix PATH : "${pkgs.glibc}/bin" \
|
||||||
|
--set GDK_PIXBUF_MODULE_FILE "${pkgs.gdk_pixbuf}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" \
|
||||||
|
--set GTK_PATH "${theme}:${pkgs.gtk3}" \
|
||||||
|
--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]
|
||||||
|
theme-name = ${cfg.theme.name}
|
||||||
|
icon-theme-name = ${cfg.iconTheme.name}
|
||||||
|
background = ${ldmcfg.background}
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
|
||||||
|
services.xserver.displayManager.lightdm.greeters.gtk = {
|
||||||
|
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = true;
|
||||||
|
description = ''
|
||||||
|
Whether to enable lightdm-gtk-greeter as the lightdm greeter.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
theme = {
|
||||||
|
|
||||||
|
package = mkOption {
|
||||||
|
type = types.path;
|
||||||
|
default = pkgs.gnome3.gnome_themes_standard;
|
||||||
|
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 {
|
||||||
|
type = types.path;
|
||||||
|
default = pkgs.gnome3.defaultIconTheme;
|
||||||
|
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.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
|
||||||
|
services.xserver.displayManager.lightdm.greeter = mkDefault {
|
||||||
|
package = wrappedGtkGreeter;
|
||||||
|
name = "lightdm-gtk-greeter";
|
||||||
|
};
|
||||||
|
|
||||||
|
environment.etc."lightdm/lightdm-gtk-greeter.conf".source = gtkGreeterConf;
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
@ -18,38 +18,6 @@ let
|
|||||||
exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs}
|
exec ${dmcfg.xserverBin} ${dmcfg.xserverArgs}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
theme = pkgs.gnome3.gnome_themes_standard;
|
|
||||||
icons = pkgs.gnome3.defaultIconTheme;
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
wrappedGtkGreeter = stdenv.mkDerivation {
|
|
||||||
name = "lightdm-gtk-greeter";
|
|
||||||
buildInputs = [ pkgs.makeWrapper ];
|
|
||||||
|
|
||||||
buildCommand = ''
|
|
||||||
# This wrapper ensures that we actually get themes
|
|
||||||
makeWrapper ${pkgs.lightdm_gtk_greeter}/sbin/lightdm-gtk-greeter \
|
|
||||||
$out/greeter \
|
|
||||||
--prefix PATH : "${pkgs.glibc}/bin" \
|
|
||||||
--set GDK_PIXBUF_MODULE_FILE "${pkgs.gdk_pixbuf}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" \
|
|
||||||
--set GTK_PATH "${theme}:${pkgs.gtk3}" \
|
|
||||||
--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
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
usersConf = writeText "users.conf"
|
usersConf = writeText "users.conf"
|
||||||
''
|
''
|
||||||
[UserList]
|
[UserList]
|
||||||
@ -72,34 +40,42 @@ let
|
|||||||
${cfg.extraSeatDefaults}
|
${cfg.extraSeatDefaults}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
gtkGreeterConf = writeText "lightdm-gtk-greeter.conf"
|
|
||||||
''
|
|
||||||
[greeter]
|
|
||||||
theme-name = Adwaita
|
|
||||||
icon-theme-name = Adwaita
|
|
||||||
background = ${cfg.background}
|
|
||||||
'';
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
# Note: the order in which lightdm greeter modules are imported
|
||||||
|
# here determines the default: later modules (if enable) are
|
||||||
|
# preferred.
|
||||||
|
imports = [
|
||||||
|
./lightdm-greeters/gtk.nix
|
||||||
|
];
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
services.xserver.displayManager.lightdm = {
|
services.xserver.displayManager.lightdm = {
|
||||||
|
|
||||||
enable = mkOption {
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
default = false;
|
default = false;
|
||||||
description = ''
|
description = ''
|
||||||
Whether to enable lightdm as the display manager.
|
Whether to enable lightdm as the display manager.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
greeter = mkOption {
|
greeter = {
|
||||||
|
package = mkOption {
|
||||||
|
type = types.path;
|
||||||
description = ''
|
description = ''
|
||||||
The LightDM greeter to login via. The package should be a directory
|
The LightDM greeter to login via. The package should be a directory
|
||||||
containing a .desktop file matching the name in the 'name' option.
|
containing a .desktop file matching the name in the 'name' option.
|
||||||
'';
|
'';
|
||||||
default = {
|
|
||||||
name = "lightdm-gtk-greeter";
|
};
|
||||||
package = wrappedGtkGreeter;
|
name = mkOption {
|
||||||
|
type = types.string;
|
||||||
|
description = ''
|
||||||
|
The name of a .desktop file in the directory specified
|
||||||
|
in the 'package' option.
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -135,7 +111,6 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.etc."lightdm/lightdm-gtk-greeter.conf".source = gtkGreeterConf;
|
|
||||||
environment.etc."lightdm/lightdm.conf".source = lightdmConf;
|
environment.etc."lightdm/lightdm.conf".source = lightdmConf;
|
||||||
environment.etc."lightdm/users.conf".source = usersConf;
|
environment.etc."lightdm/users.conf".source = usersConf;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user