Hash Mismatch Error Wl-Source

Can i get assistance on resolving this? Or, is this an issue that the developer has to resolve?

type or paste code herbuilding the system configuration...
error: hash mismatch in fixed-output derivation '/nix/store/1cswdsk3kcx2rx1dzvsy25a4sv2667wl-source.drv':
         specified: sha256-IHWBvPEl0RN/0j8FaeAhlzWPeitC3bBgUCAj49aPLpw=
            got:    sha256-BnDS1n1aIQh9HJZeZv0hR7vo2l6Kf9B/11fYFbb/cpQ=
error: 1 dependencies of derivation '/nix/store/90rncdvhzk6bngh3xrhrpgcsi311apbv-cimg-3.4.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2jgzjb3cwzpiwzdgplmmqmc94k9c5j2s-gmic-qt-gimp-3.3.6.drv' failed to build
error: 1 dependencies of derivation '/nix/store/l9h912nl4da2b30nzj8a2ksnjgja3az6-gimp-with-plugins-2.10.38.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ss4k0fpxpk7953ack9qd0b98rmnk6fjh-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/d2ccy3igami4wz2ahq3v5v28jms3i0zj-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/x5rfr1hz94qb9m2w363vap9dgvwsnjw0-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/5kykzxd5f511hvk7yl3540jldidkgdn4-etc.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-xwayland-24.1.0.drv-0': Directory not empty
error (ignored): error: cannot unlink '/tmp/nix-build-nerdfonts-3.2.1.drv-0': Directory not empty
error (ignored): error: cannot unlink '/tmp/nix-build-google-fonts-unstable-2023-10-20.drv-0/source/ofl': Directory not empty
error: 1 dependencies of derivation '/nix/store/diksxw011fwa4673n2amij4lq460x18g-nixos-system-opx-5090-24.11.20240616.b60ebf5.drv' failed to builde

Reading on it that was an upstream issue - they moved tag (so hash changed) after version bump in nixpkgs:

PR with fixed hash was merged:

But it did not get to nixos-unstable as of now, when it gets there you would need to update and it should be fixed:
https://nixpk.gs/pr-tracker.html?pr=320204

Thank you. I sort of figured that was my only option, but i had not encountered one of these before.

I would not say it’s your only option.
There are a lot of options to build your system right now:

  • stay on nixos-unstable version before that cimg version bump and wait until hash fix get there.
  • do not use cimg or anything that depends on it
  • overlay that package with fixed hash

But the easiest would be to just wait until it gets to nixos-unstable (option 1).

I appreciate the additional information. I forgot about using an overlay. I think I will just heed your advice and stick with waiting for the hash to get updated by the developer…

1 Like

How exactly do I do that in configuration.nix? I can’t seem to find a good reference, only hints. I tried this:


nixpkgs.overlays = [
  (_final: prev: {
    inherit
      (import pkgs.fetchzip
        {
          url = "https://github.com/fabaff/nixpkgs/archive/cimg-fix-hash.tar.gz";
          sha256 = "sha256-BnDS1n1aIQh9HJZeZv0hR7vo2l6Kf9B/11fYFbb/cpQ=";
        }
        {
          overlays = [ ];
          inherit (prev) config;
        }
      )
      cimg
      ;
  })
];

That one fails with “error: cannot coerce a set to a string”.

I also tried this:

nixpkgs.overlays = [
  (_final: prev: {
    cimg = prev.cimg.overrideAttrs (old: {
      patches = (old.patches or [ ]) ++ [
        (pkgs.fetchpatch {
          url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/320204.patch";
          hash = "sha256-qg+mkhZQE/H9aNjXRFn+Kh7u+Zse2mxubFz+XB9/Dj8=";
        })
      ];
    });
  })
];

It builds, but I still get the original error:

error: hash mismatch in fixed-output derivation '/nix/store/1cswdsk3kcx2rx1dzvsy25a4sv2667wl-source.drv':
         specified: sha256-IHWBvPEl0RN/0j8FaeAhlzWPeitC3bBgUCAj49aPLpw=
            got:    sha256-BnDS1n1aIQh9HJZeZv0hR7vo2l6Kf9B/11fYFbb/cpQ=

Not sure what first is supposed to do.
But second won’t work, because you are trying to apply patch to package src, not .nix file in nixpkgs where hash is.

You need to either patch nixpkgs with something like:

let
  nixpkgsPatches = [
    {
      url = "https://patch-diff.githubusercontent.com/raw/NixOS/nixpkgs/pull/320204.patch";
      hash = "sha256-qg+mkhZQE/H9aNjXRFn+Kh7u+Zse2mxubFz+XB9/Dj8=";
    }
  ];
  pkgsOrigin = (import nixpkgs { inherit system; });
  pkgsPatched = (
    pkgsOrigin.applyPatches {
      name = "nixpkgs-patched";
      src = inputs.nixpkgs;
      patches = map pkgsOrigin.fetchpatch nixpkgsPatches;
    }
  );
  pkgs = import pkgsPatched { inherit system; };
in
...

(there may or may not be extra import there, not sure)

or overrideAttrs with src:

overlays = [
  (final: prev: {
    cimg = prev.cimg.overrideAttrs (old: {
      src = prev.pkgs.fetchFromGitHub {
        owner = "GreycLab";
        repo = "CImg";
        rev = "refs/tags/v.3.4.0";
        hash = "sha256-BnDS1n1aIQh9HJZeZv0hR7vo2l6Kf9B/11fYFbb/cpQ=";
      };
    });
  })
];

Thought it’s probably too late, because fix already got to nixos-unstable.