Override default lightdm-gtk-greeter.conf in configuration.nix

services.xserver.displayManager.lightdm = {
  enable = true;  # Enable the LightDM display manager

  # Set the background directly (this is a structured option)
  background = "/path/to/file";

  # Use extraConfig to append custom raw configuration options to the LightDM config
  extraConfig = ''
    # LightDM Greeter Settings (non-structured options)
    theme-name = "whatever"  #Theme for the greeter
    user-background = false
    position = "87%,center"
    hide-user-image = true
    icon-theme-name = "whatever"   
    indicators = "~session;~host;~clock"
    # default-user-image = ""  # Uncomment to set a default user image
  '';

  # Structured greeter settings
  greeter = {
    # You can configure greeter-related settings here if available
    # Example: greeter.language = "en_US";
    # greeter.layout = "us";
  };

  # Optional autoLogin setting
  # Uncomment and configure the following line to enable auto-login for a user:
  # autoLogin = {
  #   enable = true;
  #   user = "your-username";
  # };

  # Optional: if you have multiple greeters, you can define them here
  # greeters = ["lightdm-webkit2-greeter"];
  };

In summary of the situation to date, above is the most recent configuration that also caused the session to drop into the login screen, with the notable difference that my desired background was displayed, but the theme designated was not applied to the logon box, nor was the logon box position in the designated location. Also notable, a red colored spot appeared in the terminal when rebuilding and before dropping the session down to the login screen.

In view that the default symlinked configuration utilizes the following parameters:

[greeter] 

theme-name = Adwaita 
icon-theme-name = Adwaita 
cursor-theme-name = Adwaita 
cursor-theme-size = 16 
background = /nix/store/42c21vvm60lb6ppd9hly3c928y9s3x6i-simple-dark-gray-2018-08-28/share/backgrounds/nixos/nix-wallpaper-simple-dark-gray_bottom.png    

and when the same lightdm /nix/store end-of-symlink .conf file is manually modified:

[greeter]  

background = /path/to/file 
theme-name = whatever 
icon-theme-name = whatever 
indicators = ~session;~host;~clock 
position = 87%,center user-background = false hide-user-image = true #default-user-image = /path/to/file  

All of the relevant parameters are displayed in the logon screen.

The extraConfig section within configuration.nix does not implement these designated modification to the logon screen, but directly modification to the /nix/store does.

This indicates to me that something is broken or omitted in the lightdm configuration when “background” is a parameter recognized with configuration.nix, but other configuration parameters are not recognized in configuration.nix, but are recognized in the /nix/store .conf file.

Certainly if changes to the default configuration of NixOS are to be make within configuration.nix, the method of doing so should be much more straightforward than that encountered in this example.

Does this situation need to be reported as a bug?

Additionally noted is that rebuilding after commenting out everything except the “background” designation within the configuration.nix lightdm snippet also produces a crash to the login screen as well as a reversion to kernel version 6.9.7 from the then current 6.18.

Sounds like you’ve done more than change your lightdm config; this implies that you’re reverting to NixOS 25.05 as well. Are you using flakes or channels, and if you’re using channels, did you update your system channels, and have you deleted your user channels?

I wouldn’t report bugs yet, sounds like some of the issues you’re seeing might be caused by seemingly unrelated config.

nix-channel --list

nixos nixos-23.11 release nixos-23.11.7870.205fd4226592
nixpkgs nixos-25.11 release nixos-25.11.1335.09eb77e94fa2

Delete those channels.
Then run sudo nix-channel --list, we should see what the root channels are.

sudo nix-channel --remove nixos
uninstalling 'nixos-23.11'
building '/nix/store/p7cxl2wfq5vmqkq6k3j5hjhdkp39m01m-user-environment.drv'...

nix-channel --list  (empty)

sudo nix-channel --list
nixpkgs https://nixos.org/channels/nixos-25.11

If you try to build your configuration again, now that you have exactly one channel, and reboot and see what the result is, what happens?

Also, please use nixos-rebuild boot --sudo - not switch to switch to your new config.

Sorry, before seeing your reply the following were executed cli:

sudo nix-channel --add nixos-25.11 release nixos-25.11.1335.09eb77e94fa2 nixos
sudo nix-channel --update
sudo nixos-rebuild switch

sudo nix-channel --list
nixos nixos-25.11 release nixos-25.11.1335.09eb77e94fa2
nixpkgs nixos-25.11 release nixos-25.11.1335.09eb77e94fa2

There was no problem with reverting to kernel 6.9.7, after removing

nixos-23.11 release nixos-23.11.7870.205fd4226592 


In addition, upon rebuild there was no crash into logon screen.

Garbage collection and optimize freed up a lot of space.

Getting back to the original objectives of overriding the default lightdm greeter screen and installing custom icons and a custom theme, here are relevant entries to configuration.nix that appear to work regarding the greeter screen, but further investigation is necessary to determine if the custom theme and custom icons were installed system wide.

For the benefit of anyone going a similar route, the ./themes and ./icons paths are relative to “themes” and “icons” directories created within /etc/nixos and holding the respective custom theme and custom icon theme":

 ##############################################################
  ## 1. Install custom theme & icon theme system-wide
  ##############################################################

  # Copy custom GTK theme to /etc/share/themes
  environment.etc."share/themes/whatever_theme".source =
    ./themes/whatever_theme;

  # Copy custom icon theme to /etc/share/icons
  environment.etc."share/icons/whatever_icon_theme".source =
    ./icons/whatever_icon_theme;

  ##############################################################
  ## 2. Enable X11 + LightDM + GTK greeter
  ##############################################################

  services.xserver.enable = true;
  services.xserver.displayManager.lightdm.enable = true;
  services.xserver.displayManager.lightdm.greeters.gtk.enable = true;

  ##############################################################
  ## 3. Replace LightDM GTK greeter config completely
  ##############################################################

  environment.etc."lightdm/lightdm-gtk-greeter.conf".source =
    lib.mkForce ./lightdm-gtk-greeter.conf; # Use lib.mkForce to enforce priority of this custom config  

#note that file lightdm-gtk-greeter.conf with the custom greeter configuration is within the /etc/nixos directory.

You only need one of these. Of the two, I would recommend keeping only the nixos channel, since various bits of documentation will tell you to change it; Otherwise you risk accidentally not updating your system for two years again :wink:

Thanks to TLATER, waffle8946, and eblechschmidt for the prompt replies.

Tested the override for lightdm-gtk-greeter.conf located in /etc/nixos/lightdm-gtk-greeter.conf and it did not override the /etc/lightdm/lightdm-gtk-greeter.conf symlinked to static and ultimately to /nix/store.

Can anyone propose a configuration.nix snippet that will override the /etc/lightdm/lightdm-gtk-greeter.conf symlink chain?

Have a look at: NixOS Search

According to information available on the web extraConfig parameters are applied to late to override the symlinked default configuration.

The following configuration also fails:

 ###############################################
  ## LightDM + GTK Greeter
  ###############################################
  services.xserver.displayManager.lightdm = {
  enable = true;  # Enable the LightDM display manager

  # Set the background directly (this is a structured option)
  background = "/path/to/file";

  # Use extraConfig to append custom raw configuration options to the LightDM config
  extraConfig = ''
    # LightDM Greeter Settings (non-structured options)
    theme-name = "whatever theme"  #Theme for the greeter
    user-background = false
    position = "87%,center"
    hide-user-image = true
    icon-theme-name = "whatever icon theme"   
    indicators = "~session;~host;~clock"
    # default-user-image = ""  # Uncomment to set a default user image
  '';

  # Structured greeter settings
  greeter = {
    # You can configure greeter-related settings here if available
    # Example: greeter.language = "en_US";
    # greeter.layout = "us";
  };

  # Optional autoLogin setting
  # Uncomment and configure the following line to enable auto-login for a user:
  # autoLogin = {
  #   enable = true;
  #   user = "your-username";
  # };

  # Optional: if you have multiple greeters, you can define them here
  # greeters = ["lightdm-webkit2-greeter"];
  };

Manually editing the /nix/store configuration file works, but no configuration.nix parameters have functioned in over 40 attempts, including using AI to scan relevant NixOS and github documentation.

Exposing only the higher level “background” parameter appears to be insufficient.

It is reasonable to conclude that lightdm needs to be modified in order to expose additional parameters in order to utilize configuration.nix to make persistent changes that survive reboot.

At this point there appears to be no reasonable alternative but to file a bug.

Thank you.

Did you even read the link I provided?

From that link:

Extra configuration that should be put in the lightdm-gtk-greeter.conf configuration file.

I think it is exactly what you need.

2 Likes

The only thing wrong here is the insistence on using autocomplete-with-more-steps rather than what people have provided.

In this case, the LLM is trying to set services.xserver.displayManager.lightdm.extraConfig when the correct option to set is services.xserver.displayManager.lightdm.greeters.gtk.extraConfig. These are completely different options. Please read what people are saying rather than filtering it through an LLM that’s trained on what people have posted online anyway then hallucinates nonsensical code.

Also, as mentioned, fix your channels to ensure there is only one root channel called nixos pointing at the 25.11 url, support is not provided for anything older than 25.11 at this point.

1 Like

Sorry, I did read the link but did not make the distinction related by waffle8946.

Have endeavored to follow direction but following configurations fail:

  ###############################################
  ## LightDM + GTK Greeter 
  ###############################################
  services.xserver.displayManager.lightdm = {
    enable = true;

    # LightDM daemon-level configuration only
    # extraConfig = ''
    #   # (Leave empty unless you are configuring LightDM itself,
    #   # not the greeter)
    # '';

    # GTK Greeter configuration (CORRECT LOCATION)
    greeters.gtk = {
      enable = true;  # Explicitly enable the GTK greeter (often default, but good to set)

      extraConfig = ''
        background = /usr/share/backgrounds/wallpaper/stars.jpg
        theme-name = BlueMenta
        icon-theme-name = Menta
        user-background = false
        hide-user-image = true
        position = 87%,center
        indicators = ~session;~host;~clock
        # default-user-image =
      '';
     };
   };

###############################################
## LightDM + GTK Greeter 
###############################################

services.xserver.displayManager.lightdm = {
    enable = true;
  };

  services.xserver.displayManager.lightdm.greeters.gtk.extraConfig = ''
    background = /usr/share/backgrounds/wallpaper/stars.jpg;
    theme-name = BlueMenta;
    icon-theme-name = Menta;
    user-background = false;
    hide-user-image = true;
    position = 87%,center;
    indicators = ~session;~host;~clock;
  '';
=========================================
=========================================
sudo nixos-rebuild switch  --show-trace

warning: Git not found; cannot figure out revision of '/nix/store/j4hbw1ws742nmsfhbd9r22k1qgivk7hc-nixos-25.11/nixos'
building the system configuration...
these 3 derivations will be built:
  /nix/store/9dhc8d69nbbmrrqmiynzpl81hrsyl6ff-lightdm-gtk-greeter.conf.drv
  /nix/store/x7b2swi96w4nl1xwsw1w4ccxdafalg1d-etc.drv
  /nix/store/dyx6r1dk16agw9z3c9gpn6cyd2x6m5fh-nixos-system-nixos-25.11.1335.09eb77e94fa2.drv
building '/nix/store/9dhc8d69nbbmrrqmiynzpl81hrsyl6ff-lightdm-gtk-greeter.conf.drv'...
building '/nix/store/x7b2swi96w4nl1xwsw1w4ccxdafalg1d-etc.drv'...
building '/nix/store/dyx6r1dk16agw9z3c9gpn6cyd2x6m5fh-nixos-system-nixos-25.11.1335.09eb77e94fa2.drv'...
updating GRUB 2 menu...
activating the configuration...
setting up /etc...
reloading user units for desconosido...
restarting sysinit-reactivation.target
the following new units were started: NetworkManager-dispatcher.service
Done. The new configuration is /nix/store/9ymcjq5mqy7hza2y37ziw9vga712m365-nixos-system-nixos-25.11.1335.09eb77e94fa2
=================================
=================================
/etc/lightdm/lightdm-gtk-greeter.conf prior to reboot, appends to default, after reboot, reverts:

[greeter]
theme-name = Adwaita
icon-theme-name = Adwaita
cursor-theme-name = Adwaita
cursor-theme-size = 16
background = /nix/store/42c21vvm60lb6ppd9hly3c928y9s3x6i-simple-dark-gray-2018-08-28/share/backgrounds/nixos/nix-wallpaper-simple-dark-gray_bottom.png

background = /usr/share/backgrounds/wallpaper/stars.jpg;
theme-name = BlueMenta;
icon-theme-name = Menta;
user-background = false;
hide-user-image = true;
position = 87%,center;
indicators = ~session;~host;~clock;
====================================

What is failing?

This usually happens if you switch between grub and systemd-boot, or do other inadvisable things with bootloaders.

If you do those things, you need to tell nixos-rebuild to reinstall the bootloader with the --install-bootloader flag, and perhaps do a bit of manual cleanup in /boot.

I’d suggest switching back to systemd-boot also, grub only rarely makes sense. Do this before installing the bootloader.