From fb5e14091e915378b5ee79c8227bcf1ddb85c3d1 Mon Sep 17 00:00:00 2001 From: Henry-Hiles Date: Tue, 1 Dec 2026 11:50:00 -0500 Subject: [PATCH] don't rebuild half the world for the gtk3 patch --- linux/nix/default.nix | 47 ++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/linux/nix/default.nix b/linux/nix/default.nix index 6da2a60..5611f52 100644 --- a/linux/nix/default.nix +++ b/linux/nix/default.nix @@ -14,23 +14,36 @@ android_sdk.accept_license = true; allowUnfree = true; }; - overlays = [ - (_: prev: { - # Without this, GTK3 can't create a GL context on Mesa builds without GLES 1 - # (Flathub's since 26.2.8). Drop once nixpkgs has a GTK3 release with it. - gtk3 = prev.gtk3.overrideAttrs (old: { - patches = old.patches or [ ] ++ [ ./patches/gtk3-egl-renderable-type.patch ]; - }); - }) - ]; }; packages = let - default = pkgs.callPackage ./pkg { + unpatched = pkgs.callPackage ./pkg { src = self; commit = self.shortRev or self.dirtyShortRev; }; + + # Without this, GTK3 can't create a GL context on Mesa builds without GLES 1 + # (Flathub's since 26.2.8). Drop once nixpkgs has a GTK3 release with it. + # Swapped into the finished closure, as an overlay would rebuild half of nixpkgs + withPatchedGtk = + drv: + pkgs.replaceDependencies { + inherit drv; + replacements = [ + { + oldDependency = pkgs.gtk3; + newDependency = pkgs.gtk3.overrideAttrs (old: { + patches = old.patches or [ ] ++ [ ./patches/gtk3-egl-renderable-type.patch ]; + }); + } + ]; + } + // { + inherit (drv) pname version meta; + }; + + default = withPatchedGtk unpatched; in { inherit default; @@ -41,12 +54,14 @@ appId = "nexus.federated.nexus"; # The runtime's GStreamer gets loaded instead of ours, and it can't # load our plugins, so keep wrapGAppsHook from pointing it at them - package = default.overrideAttrs (old: { - postInstall = '' - unset GST_PLUGIN_SYSTEM_PATH_1_0 - '' - + old.postInstall; - }); + package = withPatchedGtk ( + unpatched.overrideAttrs (old: { + postInstall = '' + unset GST_PLUGIN_SYSTEM_PATH_1_0 + '' + + old.postInstall; + }) + ); runtime = "org.gnome.Platform/51"; permissions = { share = [ "network" ];