Applying a patch to gnome.mutter via a NixOS option?

So today, via our gnome 43 → 44 update PR I got the link to gnome’s issue I’ve been experiencing ever since the update. A very annoying issue indeed.

There it is suggested that reverting upstream’s 3ac82a58 can fix the issue.

How can I apply a fixing patch to mutter? While using NixOS’ services.gnome module?

Overlays - NixOS Wiki, so likely:

{
  nixpkgs.overlays = [
    (self: super: {
      gnome = super.gnome.overrideScope' (pself: psuper: {
        mutter = psuper.mutter.overrideAttrs (oldAttrs: {
          patches = (oldAttrs.patches or [ ]) ++ [
            (super.fetchpatch {
              url = "https://gitlab.gnome.org/GNOME/mutter/-/commit/3ac82a58c51a5c8db6b49e89a1232f99c79644cc.patch";
              hash = "sha256-L8GGEFHE566yvpAAVXA8bn2hvDfFAO8S/MqPM3Oki90=";
              revert = true;
            })
          ];
        });
      });
    })
  ];
}

(I have the impression that mutter is mainly used as library here, and ${patchedmutter}/bin/mutter --replace will not likely give what you want, if you are thinking of adding an NixOS option to do that)

1 Like

Thanks for the help, it looks like you use this overlay already… And indeed, according to ofborg it won’t introduce too many rebuilds: