Merge pull request #140096 from Artturin/gdmoptions

authored by Artturi and committed by GitHub 8296c4d2 2652e0b4

+33 -24
+33 -24
nixos/modules/services/x11/display-managers/gdm.nix
··· 6 7 cfg = config.services.xserver.displayManager; 8 gdm = pkgs.gnome.gdm; 9 10 xSessionWrapper = if (cfg.setupCommands == "") then null else 11 pkgs.writeScript "gdm-x-session-wrapper" '' ··· 103 (Does not affect automatic suspend while logged in, or at lock screen.) 104 ''; 105 type = types.bool; 106 }; 107 108 }; ··· 270 # Use AutomaticLogin if delay is zero, because it's immediate. 271 # Otherwise with TimedLogin with zero seconds the prompt is still 272 # 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 - ''; 298 299 environment.etc."gdm/Xsession".source = config.services.xserver.displayManager.sessionData.wrapper; 300
··· 6 7 cfg = config.services.xserver.displayManager; 8 gdm = pkgs.gnome.gdm; 9 + settingsFormat = pkgs.formats.ini { }; 10 + configFile = settingsFormat.generate "custom.conf" cfg.gdm.settings; 11 12 xSessionWrapper = if (cfg.setupCommands == "") then null else 13 pkgs.writeScript "gdm-x-session-wrapper" '' ··· 105 (Does not affect automatic suspend while logged in, or at lock screen.) 106 ''; 107 type = types.bool; 108 + }; 109 + 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 122 }; ··· 284 # Use AutomaticLogin if delay is zero, because it's immediate. 285 # Otherwise with TimedLogin with zero seconds the prompt is still 286 # presented and there's a little delay. 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; 307 308 environment.etc."gdm/Xsession".source = config.services.xserver.displayManager.sessionData.wrapper; 309