@@ -6,6 +6,8 @@ let
66
77 cfg = config.services.xserver.displayManager;
88 gdm = pkgs.gnome.gdm;
9+ settingsFormat = pkgs.formats.ini { };
10+ configFile = settingsFormat.generate "custom.conf" cfg.gdm.settings;
911
1012 xSessionWrapper = if (cfg.setupCommands == "") then null else
1113 pkgs.writeScript "gdm-x-session-wrapper" ''
@@ -105,6 +107,18 @@ in
105107 type = types.bool;
106108 };
107109
110+ settings = mkOption {
111+ type = settingsFormat.type;
112+ default = { };
113+ example = {
114+ debug.enable = true;
115+ };
116+ description = ''
117+ Options passed to the gdm daemon.
118+ See <link xlink:href="https://help.gnome.org/admin/gdm/stable/configuration.html.en#daemonconfig">here</link> for supported options.
119+ '';
120+ };
121+
108122 };
109123
110124 };
@@ -270,31 +284,26 @@ in
270284 # Use AutomaticLogin if delay is zero, because it's immediate.
271285 # Otherwise with TimedLogin with zero seconds the prompt is still
272286 # presented and there's a little delay.
273− environment.etc."gdm/custom.conf".text = ''
274− [daemon]
275− WaylandEnable=${boolToString cfg.gdm.wayland}
276− ${optionalString cfg.autoLogin.enable (
277− if cfg.gdm.autoLogin.delay > 0 then ''
278− TimedLoginEnable=true
279− TimedLogin=${cfg.autoLogin.user}
280− TimedLoginDelay=${toString cfg.gdm.autoLogin.delay}
281− '' else ''
282− AutomaticLoginEnable=true
283− AutomaticLogin=${cfg.autoLogin.user}
284− '')
285− }
286−
287− [security]
288−
289− [xdmcp]
290−
291− [greeter]
292−
293− [chooser]
294−
295− [debug]
296− ${optionalString cfg.gdm.debug "Enable=true"}
297− '';
287+ services.xserver.displayManager.gdm.settings = {
288+ daemon = mkMerge [
289+ { WaylandEnable = cfg.gdm.wayland; }
290+ # nested if else didn't work
291+ (mkIf (cfg.autoLogin.enable && cfg.gdm.autoLogin.delay != 0 ) {
292+ TimedLoginEnable = true;
293+ TimedLogin = cfg.autoLogin.user;
294+ TimedLoginDelay = cfg.gdm.autoLogin.delay;
295+ })
296+ (mkIf (cfg.autoLogin.enable && cfg.gdm.autoLogin.delay == 0 ) {
297+ AutomaticLoginEnable = true;
298+ AutomaticLogin = cfg.autoLogin.user;
299+ })
300+ ];
301+ debug = mkIf cfg.gdm.debug {
302+ Enable = true;
303+ };
304+ };
305+
306+ environment.etc."gdm/custom.conf".source = configFile;
298307
299308 environment.etc."gdm/Xsession".source = config.services.xserver.displayManager.sessionData.wrapper;
300309