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

Reverted to systemd boot, greeter UI reverts to default.

https://discourse.nixos.org/t/switch-from-grub-to-systemd-boot/65158

# grub entries commented out of configuration.nix

boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.configurationLimit = 30;
boot.loader.efi.canTouchEfiVariables = true;

from su prompt: nixos-rebuild switch --install-bootloader

building the system configuration...
Copied "/nix/store/zf8qy81dsw1vqwgh9p9n2h40s1k0g2l1-systemd-258.2/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/systemd/systemd-bootx64.efi".
Copied "/nix/store/zf8qy81dsw1vqwgh9p9n2h40s1k0g2l1-systemd-258.2/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/BOOT/BOOTX64.EFI".
Random seed file /boot/loader/random-seed successfully refreshed (32 bytes).
Created EFI boot entry "Linux Boot Manager".
--------------------------
reboot reverts to default greeter UI
--------------------------
sudo nixos-rebuild boot

building the system configuration...
Done. The new configuration is /nix/store/hvnd47lnwd9w4zxrkh4spw94h6lfqvrk-nixos-system-nixos-25.11.1335.09eb77e94fa2
--------------------------
reboot reverts to default greeter UI
--------------------------

What is failing?

Note that the following configuration generates a new /nix/store link, and

systemctl restart display-manager

restarts the greeter UI with specified changes written to /etc/lightdm/lightdm-gtk-greeter.conf and the symlink chain resolves to:

/nix/store/9ki0xhsh211sb87bljpyjdnrmd270as4-lightdm-gtk-greeter.conf

However upon reboot the configuration reverts to:

/nix/store/kzm8440ckf63rx3rhzsa1idyks9s5yv8-lightdm-gtk-greeter.conf

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

  greeters.gtk = {
    enable = true;  # Explicit, though often default

    # Structured options (these override defaults cleanly)
    theme.name = "BlueMenta";
    iconTheme.name = "Menta";
    cursorTheme.name = "Adwaita";  # Or your preferred; defaults to Adwaita if omitted
    cursorTheme.size = 16;         # Optional

    indicators = [ "~session" "~host" "~clock" ];

    # For other settings not covered by structured options
    extraConfig = ''
      background = /usr/share/backgrounds/wallpaper/stars.jpg
      user-background = false
      hide-user-image = true
      position = 87%,center
    '';
   };
 };
=

I don’t know; the bootloader thing was an educated guess. I can’t see the files on your system.

When NixOS boots, the boot loader instructs Linux to run an activation script that installs a specific configuration. Each “version” of your configuration has one of these scripts. When you use nixos-rebuild switch, this creates and runs a new activation script, and sets the bootloader configuration to run this new activation script by default.

We refer to this concept as a “generation”.

So what’s happening is:

  • First boot; you “select” the default grub/systemd-boot entry
    • This executes the current “generation”
  • nixos-rebuild switch → new generation is created, activated and written to a new boot entry
    • The switch command means that during this boot you now have the new lightdm configuration
    • If you use boot instead, running the script during the current boot is skipped
    • I usually recommend using boot if you aren’t experimenting, switch doesn’t always result in a working system, since for example kernel or boot changes can’t be applied immediately, so it creates a half-applied state that doesn’t really reflect your configuration
  • Shutdown & reboot; you “select” the default grub/systemd-boot entry
    • The default grub/systemd-boot entry for some reason runs the old generation’s activation script; this installs the lightdm config from before the switch

While this might look like an issue with the lightdm module to a newbie, the issue is actually somewhere in your boot setup. Right now your system is quite broken, you can’t make any changes to your configuration, including updates.

You can prove this to yourself by running:

$ nixos-rebuild list-generations

This should list at least two generations, and the Current one won’t be the latest (unless you have used nixos-rebuild switch during the boot. If you did, the current generation will revert to an older one after you reboot).

If I were you and I didn’t want to bother debugging I’d just wipe my /boot partition and reinstall the bootloader. But I don’t know anything about the setup of your system, it’s quite possible this will leave you in an unbootable state, so if you want to go that route make sure you know how to use the NixOS installer to recover your system.

To debug I’d start looking at my grub/systemd-boot configuration files, especially before and after the switch, and then think about what I’m seeing. Hard to help you with this, though.

2 Likes

More on this:

1 Like

The possibility with an error in generations was considered and here was the output indicating that the current generation was in use and booting was not from a previous generation:

nixos-rebuild list-generations
Generation  Build-date           NixOS version            Kernel  Configuration Revision  Specialisation  Current
12          2025-12-14 15:17:10  25.11.1335.09eb77e94fa2  6.18.0  Unknown                 []              True
11          2025-12-11 21:15:20  25.11.1335.09eb77e94fa2  6.18.0  Unknown                 []              False

Perfect — this confirms your system is now running the new generation (12).
Current = True → you are actively using generation 12
Generation 11 is the previous one (Current = False)

Did you run this before or after nixos-rebuild switch? I mean, I know for sure you ran it after, but I’m asking to point you to that part of my explanation of how this works.

1 Like

Configuration.nix was modified to discontinue use of grub and boot using systemd, running:

nixos-rebuild switch --install-bootloader
sudo nixos-rebuild boot

with no change in the lightdm UI customization failure issue. It may be worthwhile to point out that I am booting using a Grub2 menuentry configured within another linux distribution on another partition on the same hard drive. NixOS was initially installed onto an existing partition prepared for the installation.

In conjunction with previous reply in this discourse, since removing older configuration data remaining from Nixos 23.11, upgrading the Nixos kernel and grub.cfg went smoothly.

In an effort to eliminate errors, all generations except the present were ultimately removed to prevent the possibility of reverting to a previous generation.

nixos-rebuild list-generations
Generation  Build-date           NixOS version            Kernel  Configuration Revision  Specialisation  Current
13          2025-12-14 16:06:35  25.11.1335.09eb77e94fa2  6.18.0  Unknown                 []              True
n 

Lightdm-gtk-greeter was reinstalled as a precaution.

Given these clarifications I ask again, what is failing?

After commenting out grub boot and entering the configuration to change to systemd, both

   nixos-rebuild switch --install-bootloader
   sudo nixos-rebuild boot 

were run, followed by a reboot to see that the lightdm UI customization had again failed.

Solved.

If booting Nixos from a Grub2 configuration installed in another linux distribution, customizing the NixOS lightdm-gtk-greeter UI via configuration.nix generates a new grub.cfg init for NixOS during rebuild. The Grub2 configuration being used to boot Nixos after rebuild needs to contain a menuentry for Nixos that includes the init generated by NixOS during the rebuild.

before rebuild:

menuentry “NixOS” --class nixos {
search --set=drive1 --fs-uuid 2AE5-3HE4
linux ($drive1)//kernels/nmi1f4lsswcr9dmm1r6j6a8b7rar5gl4-linux-6.18-bzImage init=/nix/store/1di7p3y8jk9lpdbpqzrncd9fix8a49wd-nixos-system-nixos-25.11.746.1aab89277eb2/init loglevel=4 lsm=landlock,yama,bpf
initrd ($drive1)//kernels/g54718n6a52pq9j3p5pr2ypkhx1g62y2-initrd-linux-6.18-initrd
}

after rebuild:

menuentry “NixOS” --class nixos {
search --set=drive1 --fs-uuid 2AE5-3HE4
linux ($drive1)//kernels/nmi1f4lsswcr9dmm1r6j6a8b7rar5gl4-linux-6.18-bzImage init=/nix/store/s563m1d5jaz0vs78h961icdh2zrzzdg2-nixos-system-nixos-25.11.1335.09eb77e94fa2/init loglevel=4 lsm=landlock,yama,bpf
initrd ($drive1)//kernels/g54718n6a52pq9j3p5pr2ypkhx1g62y2-initrd-linux-6.18-initrd
}

Here is the configuration.nix entry:

services.xserver.displayManager.lightdm = {
    enable = true;
    greeters.gtk = {
      enable = true;
      extraConfig = ''
        # Reference the correct background image path
        background = /path/to/background/file
        theme-name = whatever-installed-theme
        icon-theme-name = whatever-installed-icon-theme
        user-background = false
        hide-user-image = true
        position = 87%,center  # this positions the login box
        indicators = ~session;~host;~clock
      '';
    };
  };

Thanks to TLATER, waffle8946, and eblechschmidt for your generous help with this issue.