1{ 2 config, 3 lib, 4 pkgs, 5 ... 6}: 7 8with lib; 9 10let 11 12 dmcfg = config.services.xserver.displayManager; 13 ldmcfg = dmcfg.lightdm; 14 xcfg = config.services.xserver; 15 cfg = ldmcfg.greeters.gtk; 16 17 inherit (pkgs) writeText; 18 19 theme = cfg.theme.package; 20 icons = cfg.iconTheme.package; 21 cursors = cfg.cursorTheme.package; 22 23 gtkGreeterConf = writeText "lightdm-gtk-greeter.conf" '' 24 [greeter] 25 theme-name = ${cfg.theme.name} 26 icon-theme-name = ${cfg.iconTheme.name} 27 cursor-theme-name = ${cfg.cursorTheme.name} 28 cursor-theme-size = ${toString cfg.cursorTheme.size} 29 background = ${ldmcfg.background} 30 ${optionalString (cfg.clock-format != null) "clock-format = ${cfg.clock-format}"} 31 ${optionalString (cfg.indicators != null) "indicators = ${concatStringsSep ";" cfg.indicators}"} 32 ${optionalString (xcfg.dpi != null) "xft-dpi=${toString xcfg.dpi}"} 33 ${cfg.extraConfig} 34 ''; 35 36in 37{ 38 options = { 39 40 services.xserver.displayManager.lightdm.greeters.gtk = { 41 42 enable = mkOption { 43 type = types.bool; 44 default = true; 45 description = '' 46 Whether to enable lightdm-gtk-greeter as the lightdm greeter. 47 ''; 48 }; 49 50 theme = { 51 52 package = mkPackageOption pkgs "gnome-themes-extra" { }; 53 54 name = mkOption { 55 type = types.str; 56 default = "Adwaita"; 57 description = '' 58 Name of the theme to use for the lightdm-gtk-greeter. 59 ''; 60 }; 61 62 }; 63 64 iconTheme = { 65 66 package = mkPackageOption pkgs "adwaita-icon-theme" { }; 67 68 name = mkOption { 69 type = types.str; 70 default = "Adwaita"; 71 description = '' 72 Name of the icon theme to use for the lightdm-gtk-greeter. 73 ''; 74 }; 75 76 }; 77 78 cursorTheme = { 79 80 package = mkPackageOption pkgs "adwaita-icon-theme" { }; 81 82 name = mkOption { 83 type = types.str; 84 default = "Adwaita"; 85 description = '' 86 Name of the cursor theme to use for the lightdm-gtk-greeter. 87 ''; 88 }; 89 90 size = mkOption { 91 type = types.int; 92 default = 16; 93 description = '' 94 Size of the cursor theme to use for the lightdm-gtk-greeter. 95 ''; 96 }; 97 }; 98 99 clock-format = mkOption { 100 type = types.nullOr types.str; 101 default = null; 102 example = "%F"; 103 description = '' 104 Clock format string (as expected by strftime, e.g. "%H:%M") 105 to use with the lightdm gtk greeter panel. 106 107 If set to null the default clock format is used. 108 ''; 109 }; 110 111 indicators = mkOption { 112 type = types.nullOr (types.listOf types.str); 113 default = null; 114 example = [ 115 "~host" 116 "~spacer" 117 "~clock" 118 "~spacer" 119 "~session" 120 "~language" 121 "~a11y" 122 "~power" 123 ]; 124 description = '' 125 List of allowed indicator modules to use for the lightdm gtk 126 greeter panel. 127 128 Built-in indicators include "~a11y", "~language", "~session", 129 "~power", "~clock", "~host", "~spacer". Unity indicators can be 130 represented by short name (e.g. "sound", "power"), service file name, 131 or absolute path. 132 133 If set to null the default indicators are used. 134 ''; 135 }; 136 137 extraConfig = mkOption { 138 type = types.lines; 139 default = ""; 140 description = '' 141 Extra configuration that should be put in the lightdm-gtk-greeter.conf 142 configuration file. 143 ''; 144 }; 145 146 }; 147 148 }; 149 150 config = mkIf (ldmcfg.enable && cfg.enable) { 151 152 services.xserver.displayManager.lightdm.greeter = mkDefault { 153 package = pkgs.lightdm-gtk-greeter.xgreeters; 154 name = "lightdm-gtk-greeter"; 155 }; 156 157 environment.systemPackages = [ 158 cursors 159 icons 160 theme 161 ]; 162 163 environment.etc."lightdm/lightdm-gtk-greeter.conf".source = gtkGreeterConf; 164 165 }; 166}