From 42d601e9352984d3a7ee566c516c9e4ef9800f10 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Thu, 7 Sep 2023 21:48:23 +0200 Subject: [PATCH] fractional scaling in X11 --- modules/gnome-fractional-scaling.home.nix | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/modules/gnome-fractional-scaling.home.nix b/modules/gnome-fractional-scaling.home.nix index 3d3d35f..d6c1cc8 100644 --- a/modules/gnome-fractional-scaling.home.nix +++ b/modules/gnome-fractional-scaling.home.nix @@ -10,6 +10,7 @@ # Overlays. # https://nixos.wiki/wiki/Overlays#In_NixOS + # https://discourse.nixos.org/t/use-specific-pkg-version-in-overlay/32741/3 nixpkgs.overlays = [ ( # Patched version of mutter 44.2. @@ -32,15 +33,19 @@ final: prev: { # Elements of pkgs.gnome must be taken from gfinal and gprev. gnome = prev.gnome.overrideScope' (gfinal: gprev: { - mutter = gprev.mutter.overrideAttrs (oldAttrs: { - patches = (oldAttrs.patches or []) ++ [ - (prev.fetchpatch { - url = "https://salsa.debian.org/gnome-team/mutter/-/raw/ubuntu/44.2-3ubuntu1/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch"; - # Determining the hash: https://github.com/NixOS/nixpkgs/issues/191128#issuecomment-1246030431 - hash = "sha256-GCtz87C1NgxenYE5nbxcIIxqNhutmdngscnlK10fRyQ="; - }) - ]; - }); + mutter = gprev.mutter.overrideAttrs (oldAttrs: + if oldAttrs.version == "44.2" then + { + patches = (oldAttrs.patches or []) ++ [ + (prev.fetchpatch { + url = "https://salsa.debian.org/gnome-team/mutter/-/raw/ubuntu/44.2-3ubuntu1/debian/patches/ubuntu/x11-Add-support-for-fractional-scaling-using-Randr.patch"; + # Determining the hash: https://github.com/NixOS/nixpkgs/issues/191128#issuecomment-1246030431 + hash = "sha256-GCtz87C1NgxenYE5nbxcIIxqNhutmdngscnlK10fRyQ="; + }) + ]; + } + else throw "Mutter version mismatch. Please update patch." + ); }); } )