Normalized patch is empty

Hi!

Trying to switch my NixOS install to flakes but running into errors, see below output:

$ nix log /nix/store/higqjjhpb6jnqz8k6jiczhb1h5f06z6i-attachment.cgi?id=359589.drv

trying https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0^M100   169  100   169    0     0    463      0 --:--:-- --:--:-- --:--:--   4>
^M100  1316  100  1316    0     0   1811      0 --:--:-- --:--:-- --:--:--  1811
error: Normalized patch '/build/patch' is empty (while the fetched file was not)!
Did you maybe fetch a HTML representation of a patch instead of a raw patch?
Fetched file was:
<FD>7zXZ^@^@^D<E6>ִF^B^@!^A^\^@^@^@^P<CF>X<CC><E0>^MB^D<E1>]^@#^\<89><E6><F6><DF>('IY<F8>Dt<D4>yr<83><AF><87><CB>^L^\<B8><F0>^G<EA>^N;~<E3>)p<D7>ztZ?<93><D3><F9><82>KR<8D>S^RK<A9>Xhs'<A4>\w^SS%<A5><E7><96>M<CB>I<EA>z<E0>=<92>1<AC>^H?<BF>'=M^Vd<86>a<E4><D6>PrI$^?<87><FD>S"<FD>y^O<9E>U<F9>^K<8B><AB>`E2<A2>)^G^MG<DB>^G^A<81>.<A9>v^?^N^V$T^NQ^S8<E0>+=<CD><DA>Y<D1>R<D2><D5>U<F1><9B>v+<B2><C0>^X<8A>I<D7>;<90><B1><90><D2>*<87>x<F6>1<E5><BE>db<<F1><81><8D>*^s<A6>^E<E7><8D>ٴG<A2>^G<B9><D1><D0>^L>><DB>-<8B><B9>'<C2>!h<E6>5<DE>^L<BC><DC>ݍ}<94><F3>Ÿ<BA>##<90>-^L<C6>[<A3>L<C9>^N<84><DF>YRpF<A2>.<D9>8ݲ<BE>P^K&J^QN<87><C6>Z ><D1>^Rn=ve<8B><BF>li^E<F2>><E8><9A><C8>vH<EC>O5<BB><96><E5><A7>'<EC><DA><F7><C1>=<8B>j><8D>^T<B9><93><E0>s^]^U<94>^K<EF>^MGG^S<82><FA><F8>v$^S<99>^C^HJ<E1><A9><EE><FC>Ш8<AA>ia`<AE>^H-ý@<B1><A2><E9>0<CD>(@<CD>-<E6>١)#Ě<87>Ɔ+W<AC><95>^B<DF>^^<9B><9E><CF>J<B8>3w<86>$(<9A>?<A9>(^Gc;m<E2><F7>,^đ<87>9<C9>ɒf<89>^S<B8>t^KY=<FD><9D>(^]?ZQ<B1>>Mi^D<A9><E6>J<B1><92><D0>#<E5><F1>jgK#<FF><5<A6><E4><C6>q<D0><E7>Z<CE>l<BD>^?<DE>^?ބ<86>^Y<81>^A^M<BA><F8>xݛ<A1><A2>jb<FE>^L<98><C8>z=<E7><85>(<85>;ʵ<B9>^L<B5><91><C1>^X<A4>W5<ED><D7>^Q|窌%^TB<CC><D8>pQ <E9><89>=^Y@^X(<82>a<9D>0i<F7>}<BD><8B><F4>n8<D9>ȁ<A6><9C>~<CC><F6><F1><CA><F6>$,&:<DB><C8><U+0082>Ȃ>^FDj<E6>A3<C5><C1>^^X^@^@^@^@<88><8C><8B>3^?7r<DA>^@^A<FD>      <C3>^Z^@^@%<DB>^@^R<B1><C4>g<FB>^B^@^@^@^@^DYZ

Downloaded the above URL and it seems to return a valid compressed patch file, definitely not HTML. Seems like the “patch normalization” step is failing. Any ideas welcome! :slight_smile:

You probably need to manually fetchurl and decompress.

The headers claim a content-type: application/x-xz.

So the attachment system probably just delivers what it has and you need to make sense out of it on your own.

Thanks for the quick response!

I haven’t been writing any custom flakes beyond the root file for my system. Are you saying I should override the derivation’s attributes to do fetchurl and somehow figure out how to decompress it?

I mean, you are obviously using a fetchpatch somewhere, you need to fix that.

If you are not using it yourself, you need to find out where its used, such that we can fix that piece of code.

I’m trying to use stable 22.11, but sure, indirectly I am trying to use fetchpatch.

$ nix-store --query --referrers /nix/store/higqjjhpb6jnqz8k6jiczhb1h5f06z6i-attachment.cgi?id=359589.drv
/nix/store/akwh6lzrmaf24966wg4pnj5dpvfi9a10-cogl-1.22.8.drv

https://github.com/NixOS/nixpkgs/blob/7edcdf7b169c33cd3eef9aba50521ce93ee666b8/pkgs/development/libraries/cogl/default.nix
It does contain

    (fetchpatch {
      url = "https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589";
      sha256 = "0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998";
    })

It seems to have been working for at least 5 months looking at the last commit to that .nix file. And nixos-rebuild is not complaining about a SHA256 mismatch, which would have made sense if they suddenly turned on compression on the bugzilla instance. Is something broken on my machine?

Oooof…

This is interesting…

nix repl -f '<nixpkgs>'
Welcome to Nix 2.15.0pre20230302_8730d30. Type :? for help.

Loading installable ''...
Added 18455 variables.
nix-repl> :b fetchpatch {
                url = "https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589";
                sha256 = "0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998";
              }

This derivation produced the following outputs:
  out -> /nix/store/ywn0cdjyqxfidqim3ycx2shibf3g0vg0-attachment.cgi?id=359589
^D
$ head '/nix/store/ywn0cdjyqxfidqim3ycx2shibf3g0vg0-attachment.cgi?id=359589'
--- a/cogl/cogl-context.h
+++ b/cogl/cogl-context.h
@@ -290,6 +290,7 @@
   COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
   COGL_FEATURE_ID_TEXTURE_RG,
   COGL_FEATURE_ID_BUFFER_AGE,
+  COGL_FEATURE_ID_SHADER_TEXTURE_LOD,

   /*< private >*/
   _COGL_N_FEATURE_IDS   /*< skip >*/

And it seems as if I can build cogl from master and the linked commit quite well and without any issues…

Do you have any overlays in place?

$ nix repl -f '<nixpkgs>'
Welcome to Nix 2.11.1. Type :? for help.

Loading installable ''...
Added 17741 variables.
nix-repl> fetchpatch {
                                    url = "https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589";
                                    sha256 = "0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998";
                                  }
ÂŤderivation /nix/store/z1kh4j4i9whzs5c8g1zlw7jjc9cms6qc-attachment.cgi?id=359589.drvÂť

The hash part of the nix store is different both from yours and from when I run nixos-rebuild. :\

Sorry for the delay,

Nope, no overlays, here is my flake.nix:

{
	description = "NixOS flake configuration";

	inputs = {
		nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";

		home-manager = {
			url = "github:nix-community/home-manager";
			inputs.nixpkgs.follows = "nixpkgs";
		};
	};

	outputs = inputs@{ self, nixpkgs, home-manager }: {
		nixosConfigurations = {
			hostName = nixpkgs.lib.nixosSystem {
				modules = [
					home-manager.nixosModules.home-manager
					./configuration.nix
				];
			};
		};
	};
}

Not sure if it’s possible to declare overlays in configuration.nix but I don’t have any there either.

Yes, it is possible. Is your full flake public? I’d like to see if I can reproduce the issue.

Cheers! I’ll tidy it up a bit, see if I can make the configuration.nix succeed again without the flake and publish the whole thing on my Github.

While cleaning up my config and rolling back some changes, the error just happened to disappear. My nix-channel settings may have been a bit borked (mixing unstable / 22.11), and I also had caching/substitution turned off (although I was failing to turn it on again, nix.conf wasn’t updating for some reason, found some useful info in your answer here How to use binary cache in NixOS - #4 by NobbZ).

Finally getting my configs under version control now, sorry I didn’t have that earlier, then it would maybe had been easier to figure out the issue.

Still have the compressed and uncompressed versions of the patch file. What encoding are the hashes for patches in the .nix files (0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998)? Looks like it could be base32hex, but it doesn’t match up with the files I got.

I’ll try turning caching off again and try rebuilding cogl later today to see if I can get a repro. Not sure if I can delete it from the nix store to force a rebuild if it’s still in use.

Thank you for your help so far @NobbZ!

Most hashes you see in nixpkgs are refering to the uncompressed content, not the compressed individual “container”.

The exact format of the hash varies, and base16, base32, base64 and SRI are valid ways to write down the hash. Current versions of nix, will write out hashes transparently in SRI notation and you are expected to use only SRI when contributing to nixpkgs, unless they are currently not understood in that location.

PS: There is no such thing as base32hex. “Hexa” itself means “six”, and “hex” is usually used as an abbreviation for “hexadecimal” which translates to 16. So “hex” is the same as base16.

Re base32hex, see Base32 - Wikipedia

0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998

  • contains non-hexadecimal characters, excluding base16
  • contains 0 and 1, excluding RFC 4648 Base32
  • contains v, excluding z-base-32
  • contains i, exluding Crockford’s Base32
  • contains x, excluding base32hex (oops!)
  • contains a, exluding Geohash
  • contains no special symbol like = or uppercase characters making base64 and SRI statistically unlikely

So the mystery of the hash encoding goes on. Some version of base32 not listed on the Wikipedia page feels most likely.

I was able to get rid of cogl through excluding cheese which was depending on it (found through nix-store --query --referers <...cogl...>):
environment.gnome.excludePackages = [ pkgs.gnome.cheese ];

Then used nix-store --delete ... and nix-collect-garbage -d to flush it out. → Confirmed, no more cogl on system (ls /nix/store/ |grep cogl).

Built an extra time with nix.extraOptions = "substitute = false"; (seems like my nix.conf is being updated after builds, so substitute changes don’t take affect directly).

Then stopped excluding cheese.

Built and ran into same issue with /nix/store/g7v8ib2qvqxs37capkqnh6c7pyrrd8yb-attachment.cgi?id=361056.drv, “Normalized patch … is empty”! Good news. :upside_down_face:

Want to clean up my configs a bit more before posting them.

Seems like hashes in both the patch declaration and in the nix-store paths don’t contain ‘e’, ‘o’ or ‘t’ in the nix version of base32 encoding. That encoding is missing from the base32 Wikipedia page.

I have had a PR open since forever that would actually make fetchpatch capable of decompressing, by passing decoder = "xz -d" or similar.

1 Like

Boiled it down now.

Step 1: Check that /etc/nix/nix.conf really has substitute = false.
Step 2: Build the below, sudo nixos-rebuild switch --flake .#workstation
Step 3: Ensure you don’t have cogl & dependencies, ls /nix/store/ |grep cogl
Step 4: Comment out the line environment.gnome.excludePackages = [ pkgs.gnome.cheese ];
Step 5: Build again and you should get the error.

configuration.nix

{ config, pkgs, ... }:

{
  imports = [
    ./hosts/workstation/hardware-configuration.nix
  ];

  nix.settings.experimental-features = [
    "flakes"
    "nix-command"
  ];

  nix.extraOptions = "substitute = false";
  #nix.extraOptions = "substitute = true";

  boot.loader = {
    systemd-boot.enable = true;
    efi.canTouchEfiVariables = true;
    efi.efiSysMountPoint = "/boot/efi";
  };

  networking = {
    hostName = "workstation"; # Define your hostname.

    networkmanager.enable = true;
  };

  time.timeZone = "Europe/Stockholm";

  console = {
    keyMap = "sv-latin1";
  };

  # Enable the X11 windowing system.
  services.xserver = {
    enable = true;

    layout = "se";
    xkbVariant = "";

    videoDrivers = [ "nvidia" ];
    displayManager = {
      gdm.enable = true;
      gdm.wayland = false;
      defaultSession = "gnome";
    };
    desktopManager.gnome = {
      enable = true;
      favoriteAppsOverride = ''
        [org.gnome.shell]
        favorite-apps=['firefox.desktop','org.gnome.Console.desktop','org.gnome.Nautilus.desktop']
      '';
    };
  };
  environment.gnome.excludePackages = [ pkgs.gnome.cheese ];

  hardware.opengl.enable = true;
  boot.blacklistedKernelModules =  [ "nouveau" ];

  users.users.chris = {
    isNormalUser = true;
    description = "Chris";
    extraGroups = [ "networkmanager" "wheel" ];
    packages = with pkgs; [
      firefox
      meld
      sublime4
      htop
    ];
  };

  nixpkgs.config.allowUnfree = true;

  environment.systemPackages = with pkgs; [
    git
  ];

  system.stateVersion = "22.11";
}

hardware-configuration.nix

# Do not modify this file!  It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations.  Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:

{
  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/81a6726c-601e-4e09-8821-d557e26c392c";
      fsType = "ext4";
    };

  fileSystems."/boot/efi" =
    { device = "/dev/disk/by-uuid/469A-CB60";
      fsType = "vfat";
    };

  swapDevices = [ ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.eno1.useDHCP = lib.mkDefault true;
  # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp5s0.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
  hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
  # high-resolution display
  hardware.video.hidpi.enable = lib.mkDefault true;
}

flake.nix

{
  description = "NixOS flake configuration";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-22.11";

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = inputs@{ self, nixpkgs, home-manager }: {
    nixosConfigurations = {
      workstation = nixpkgs.lib.nixosSystem {
        modules = [
          home-manager.nixosModules.home-manager
          ./configuration.nix
        ];
      };
    };
  };
}

flake.lock

{
  "nodes": {
    "home-manager": {
      "inputs": {
        "nixpkgs": [
          "nixpkgs"
        ],
        "utils": "utils"
      },
      "locked": {
        "lastModified": 1678271387,
        "narHash": "sha256-H2dv/i1LRlunRtrESirELzfPWdlG/6ElDB1ksO529H4=",
        "owner": "nix-community",
        "repo": "home-manager",
        "rev": "36999b8d19eb6eebb41983ef017d7e0095316af2",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "home-manager",
        "type": "github"
      }
    },
    "nixpkgs": {
      "locked": {
        "lastModified": 1678230755,
        "narHash": "sha256-SFAXgNjNTXzcAideXcP0takfUGVft/VR5CACmYHg+Fc=",
        "owner": "nixos",
        "repo": "nixpkgs",
        "rev": "a7cc81913bb3cd1ef05ed0ece048b773e1839e51",
        "type": "github"
      },
      "original": {
        "owner": "nixos",
        "ref": "nixos-22.11",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "home-manager": "home-manager",
        "nixpkgs": "nixpkgs"
      }
    },
    "utils": {
      "locked": {
        "lastModified": 1676283394,
        "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=",
        "owner": "numtide",
        "repo": "flake-utils",
        "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073",
        "type": "github"
      },
      "original": {
        "owner": "numtide",
        "repo": "flake-utils",
        "type": "github"
      }
    }
  },
  "root": "root",
  "version": 7
}

Regardless of the base32 variant nix uses… here are the hashes I’m getting for https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589 which should have hash 0f0d9iddg8zwy853phh7swikg4yzhxxv71fcag36f8gis0j5p998 according to https://github.com/NixOS/nixpkgs/blob/7edcdf7b169c33cd3eef9aba50521ce93ee666b8/pkgs/development/libraries/cogl/default.nix

$ nix hash file attachment_359589
sha256-Nh1NfhQg4g12LJpyopu1FsEjkVoioFptBXz4hgpk/84=
$ nix hash to-base32 sha256-Nh1NfhQg4g12LJpyopu1FsEjkVoioFptBXz4hgpk/84=
1kpzch58dy3w0mnmm812ba8j7h8nnnds4wls5iv0vqi02iz4s79n
$ nix hash file attachment_359589.xz
sha256-9+dliX6fudP7M/RseG6Txj3SrIlmm1YKRFIa14d2rSA=
$ nix hash to-base32 sha256-9+dliX6fudP7M/RseG6Txj3SrIlmm1YKRFIa14d2rSA=
085dfs3xf6jj8h55d6v6i6nd4gf6jdp7hv7l6gxx7fczgs4nbrzp

No match for compressed nor uncompressed.

Cheers @qyliss for creating the decoder functionality and getting it merged!

Now on to using that to resolve the specific cogl derivation.

Was going to attempt downloading the cached copy of the patch from the central nix cache and compare the contents to the version from Bugzilla to try figuring out why not even the uncompressed hashes match. But then I realized when using the cache one doesn’t seem to get build-dependencies, only runtime-dependencies. Makes sense.

The patches were added to cogl in cogl: Add GL_ARB_shader_texture_lod and copy_sub_image support · NixOS/nixpkgs@9691049 · GitHub 5 years ago. Guess we just update the cogl .nix to use decode and trust the new uncompressed version of the patch file after a brief review. I’ll see if I can post a PR for it in the next few days.

Started on a fix for cogl (just adding the decomp without changing the hashes) and almost got it running locally on top of latest master yesterday instead of 22.11. But had a power cut mid-rebuild yesterday and since then I’ve been getting “Too many open files”-errors. Not sure if there’s something messed up with the master branch or something out of whack with my machine, haven’t had time for further investigation yet.

The reason the uncompressed hashes differed was probably the patch normalization process.

The raw uncompressed 369589-patch contains

From 78636289b073d67209a20145ef0dc003f2d77db6 Mon Sep 17 00:00:00 2001
From: Sian Cao <yinshuiboy@gmail.com>
Date: Tue, 12 Apr 2016 11:36:51 +0800
Subject: [PATCH 1/2] Add GL_ARB_shader_texture_lod support

The patch is used to do lod biased texturing. I can achieve
faster blurring of images instead of using large blur radius.

---
 cogl/cogl-context.h                |  1 +
 cogl/cogl-glsl-shader.c            | 13 +++++++++++--
 cogl/cogl-types.h                  |  3 ++-
 cogl/driver/gl/gl/cogl-driver-gl.c |  7 +++++++
 4 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/cogl/cogl-context.h b/cogl/cogl-context.h
index 07badeb..261ce49 100644
--- a/cogl/cogl-context.h
+++ b/cogl/cogl-context.h
@@ -290,6 +290,7 @@ typedef enum _CoglFeatureID
   COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
   COGL_FEATURE_ID_TEXTURE_RG,
   COGL_FEATURE_ID_BUFFER_AGE,
+  COGL_FEATURE_ID_SHADER_TEXTURE_LOD,
 
   /*< private >*/
   _COGL_N_FEATURE_IDS   /*< skip >*/
diff --git a/cogl/cogl-glsl-shader.c b/cogl/cogl-glsl-shader.c
index 196e0c7..4fb0eb5 100644
--- a/cogl/cogl-glsl-shader.c
+++ b/cogl/cogl-glsl-shader.c
@@ -87,8 +87,8 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
   const char *vertex_boilerplate;
   const char *fragment_boilerplate;
 
-  const char **strings = g_alloca (sizeof (char *) * (count_in + 4));
-  GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 4));
+  const char **strings = g_alloca (sizeof (char *) * (count_in + 5));
+  GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 5));
   char *version_string;
   int count = 0;
 
@@ -111,6 +111,15 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
       lengths[count++] = sizeof (texture_3d_extension) - 1;
     }
 
+  if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE) &&
+      cogl_has_feature (ctx, COGL_FEATURE_ID_SHADER_TEXTURE_LOD))
+    {
+      static const char shader_texture_lod_ext[] =
+        "#extension GL_ARB_shader_texture_lod : enable\n";
+      strings[count] = shader_texture_lod_ext;
+      lengths[count++] = sizeof (shader_texture_lod_ext) - 1;
+    }
+
   if (shader_gl_type == GL_VERTEX_SHADER)
     {
       strings[count] = vertex_boilerplate;
diff --git a/cogl/cogl-types.h b/cogl/cogl-types.h
index 6accf8d..77964c6 100644
--- a/cogl/cogl-types.h
+++ b/cogl/cogl-types.h
@@ -470,7 +470,8 @@ typedef enum
   COGL_FEATURE_MAP_BUFFER_FOR_READ    = (1 << 21),
   COGL_FEATURE_MAP_BUFFER_FOR_WRITE   = (1 << 22),
   COGL_FEATURE_ONSCREEN_MULTIPLE      = (1 << 23),
-  COGL_FEATURE_DEPTH_TEXTURE          = (1 << 24)
+  COGL_FEATURE_DEPTH_TEXTURE          = (1 << 24),
+  COGL_FEATURE_SHADER_TEXTURE_LOD     = (1 << 25)
 } CoglFeatureFlags;
 
 /**
diff --git a/cogl/driver/gl/gl/cogl-driver-gl.c b/cogl/driver/gl/gl/cogl-driver-gl.c
index 716d1dd..f305b6a 100644
--- a/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -568,6 +568,13 @@ _cogl_driver_update_features (CoglContext *ctx,
                       COGL_FEATURE_ID_TEXTURE_RECTANGLE, TRUE);
     }
 
+  if (_cogl_check_extension ("GL_ARB_shader_texture_lod", gl_extensions))
+    {
+      flags |= COGL_FEATURE_SHADER_TEXTURE_LOD;
+      COGL_FLAGS_SET (ctx->features,
+                      COGL_FEATURE_ID_SHADER_TEXTURE_LOD, TRUE);
+    }
+
   if (ctx->glTexImage3D)
     {
       flags |= COGL_FEATURE_TEXTURE_3D;
-- 
2.9.5

While the normalized(?) version contains

--- a/cogl/cogl-context.h
+++ b/cogl/cogl-context.h
@@ -290,6 +290,7 @@
   COGL_FEATURE_ID_PER_VERTEX_POINT_SIZE,
   COGL_FEATURE_ID_TEXTURE_RG,
   COGL_FEATURE_ID_BUFFER_AGE,
+  COGL_FEATURE_ID_SHADER_TEXTURE_LOD,
 
   /*< private >*/
   _COGL_N_FEATURE_IDS   /*< skip >*/
--- a/cogl/cogl-glsl-shader.c
+++ b/cogl/cogl-glsl-shader.c
@@ -87,8 +87,8 @@
   const char *vertex_boilerplate;
   const char *fragment_boilerplate;
 
-  const char **strings = g_alloca (sizeof (char *) * (count_in + 4));
-  GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 4));
+  const char **strings = g_alloca (sizeof (char *) * (count_in + 5));
+  GLint *lengths = g_alloca (sizeof (GLint) * (count_in + 5));
   char *version_string;
   int count = 0;
 
@@ -111,6 +111,15 @@
       lengths[count++] = sizeof (texture_3d_extension) - 1;
     }
 
+  if (_cogl_has_private_feature (ctx, COGL_PRIVATE_FEATURE_GL_PROGRAMMABLE) &&
+      cogl_has_feature (ctx, COGL_FEATURE_ID_SHADER_TEXTURE_LOD))
+    {
+      static const char shader_texture_lod_ext[] =
+        "#extension GL_ARB_shader_texture_lod : enable\n";
+      strings[count] = shader_texture_lod_ext;
+      lengths[count++] = sizeof (shader_texture_lod_ext) - 1;
+    }
+
   if (shader_gl_type == GL_VERTEX_SHADER)
     {
       strings[count] = vertex_boilerplate;
--- a/cogl/cogl-types.h
+++ b/cogl/cogl-types.h
@@ -470,7 +470,8 @@
   COGL_FEATURE_MAP_BUFFER_FOR_READ    = (1 << 21),
   COGL_FEATURE_MAP_BUFFER_FOR_WRITE   = (1 << 22),
   COGL_FEATURE_ONSCREEN_MULTIPLE      = (1 << 23),
-  COGL_FEATURE_DEPTH_TEXTURE          = (1 << 24)
+  COGL_FEATURE_DEPTH_TEXTURE          = (1 << 24),
+  COGL_FEATURE_SHADER_TEXTURE_LOD     = (1 << 25)
 } CoglFeatureFlags;
 
 /**
--- a/cogl/driver/gl/gl/cogl-driver-gl.c
+++ b/cogl/driver/gl/gl/cogl-driver-gl.c
@@ -568,6 +568,13 @@
                       COGL_FEATURE_ID_TEXTURE_RECTANGLE, TRUE);
     }
 
+  if (_cogl_check_extension ("GL_ARB_shader_texture_lod", gl_extensions))
+    {
+      flags |= COGL_FEATURE_SHADER_TEXTURE_LOD;
+      COGL_FLAGS_SET (ctx->features,
+                      COGL_FEATURE_ID_SHADER_TEXTURE_LOD, TRUE);
+    }
+
   if (ctx->glTexImage3D)
     {
       flags |= COGL_FEATURE_TEXTURE_3D;

So that’s that mystery solved.

Ran the following to find additional cases:

/nixpkgs]$ git grep bugzilla-attachments.gnome.org
pkgs/desktops/gnome-2/platform/gnome-common/default.nix:    url = "https://bug697543.bugzilla-attachments.gnome.org/attachment.cgi?id=240935";
pkgs/desktops/gnome/core/gnome-common/default.nix:    url = "https://bug697543.bugzilla-attachments.gnome.org/attachment.cgi?id=240935";
pkgs/development/libraries/cogl/default.nix:      url = "https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=359589";
pkgs/development/libraries/cogl/default.nix:      url = "https://bug787443.bugzilla-attachments.gnome.org/attachment.cgi?id=361056";
pkgs/development/libraries/gtk/2.x.nix:      url = "https://bug557780.bugzilla-attachments.gnome.org/attachment.cgi?id=306776";

The first 2 are fetchurl instead of fetchpatch. The 5th one is fetchpatch.
I’m not yet knowledgeable about how to force (re)building of individual packages/derivations. What I’ve been doing so far is excluding dependent packages from the nixos configuration, then running nix-collect-garbage, then building without cache. I know about nix-store --delete but have had mixed success with it actually allowing removal despite getting rid of linger roots.

Please excuse the verbosity as I document my Nix/NixOS learning adventure. :slight_smile:

PR: cogl: Add missing patch decompression by cbergqvist ¡ Pull Request #222218 ¡ NixOS/nixpkgs ¡ GitHub