Using gdm-settings on NixOS

I recently made an attempt to package gdm-settings for NixOS. After getting it working, I ran into a major issue. To configure GDM, this app attempts to edit a file called gnome-shell-theme.gresource. However, on NixOS, this is installed at ${gnome.gnome-shell}/share/gnome-shell-theme.gresource, meaning it’s in the Nix store and cannot be modified.

Is there any potential work around to allow this file to be modified? Or is there any other place this file can be placed at? I appreciate any help with this!

If the program supported storing the settings and modifying the data using a CLI program, you could export the settings into an ini file and then add something like the following to your configuration.nix:

  nixpkgs.overlays = [
    (final: prev: {
      gnome = prev.gnome.overrideScope' (gfinal: gprev: {
        gnome-shell = gprev.gnome-shell.overrideAttrs (attrs: {
          postFixup = attrs.postFixup or "" + ''
            export HOME="$(mktemp -d)"
            export GSETTINGS_BACKEND=keyfile
            mkdir -p "$settingsdir"
            cp "${./gdm-settings.ini}" "$settingsdir/keyfile"
            ${prev.gdm-settings}/bin/gdm-settings-modify "$out/share/gnome-shell/gnome-shell-theme.gresource"

It does have the ability to export to an ini file, but unfortunately doesn’t seem to have any cli command to write that ini file. I’ll bring that idea up in the NixOS issue on the Github page, as it would allow it to be used here.

Another idea I have, is that if it could output the modified gnome-shell-theme.gresource file, a patch could be used to modify the one in Nix.

Either way, it doesn’t seem like there’s a way to make it work out of the box at all. It’s a shame GDM makes it’s configuration so convoluted.

There is not really any configuration, you are essentially patching the source code, just like you would for a suckless program. For that reason, I would advise against replacing gresource with a file from outside the build, since this could easily lead to incompatibilities – the file does not contain just styles but also definition of the user interface.