Flake: updating src version of package to build does nothing

Hi there,

I must be missing something very basic, and I can’t figure out what. It seems to be simple: I want to update the software version of the default package of this flake.

{
  # shortened version

  outputs = { self, nixpkgs }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs { inherit system; };
      version = "v1.0.3"; # <======================= crucial part
    in
    with pkgs;
    {
      packages.${system} = {
        default =
          stdenv.mkDerivation rec {
            src = fetchzip {
              url = "https://github.com/HEnquist/camilladsp/releases/download/${version}/camilladsp-linux-amd64.tar.gz";
              hash = "sha256-zWOyPmaHRi2VIRvzFpS02tPlXNn90ogU2Q/YRx7l6eI=";
            };

    # ...

Changing the version from v1.0.3 to v2.0.1 does not change the version, though. nix build .#default does not even complain that the src.hash changed even though the src.url does. (I downloaded by hand and verified that the two TARs do indeed contain a different version.) After build, I run the tool from the result folder with the usual --version flag and it is still 1.0.3. :confused::thinking:

What is going on here? What do I have to change to make it work? My goal is to use this flake as an input to my system setup flake. (This does work for the 1.0.3 version, and now I want to update the software.)

Thank you in advance!!

I had to update the sha256 hash to sha256-T+DfYBQKXwgAeycCQHAGuhFAg9VFhvY8ebCuEEFGn3A=

./result/bin/camilladsp --version
CamillaDSP 2.0.1

Seems like the hash mismatch error got buried? Odd to me also that nix hash to-sri --type sha256 $(nix-prefetch-url --unpack https://github.com/HEnquist/camilladsp/releases/download/v2.0.1/camilladsp-linux-amd64.tar.gz) produces the wrong hash? :woozy_face:

Hi, and thank you for the quick help. It seems to work–at least building the flake does something now :slight_smile: .

Before rushing on to integrating it into my system, I’d like to share this curiosity that surprised me. Maybe it’s interesting/quirky for some, maybe somebody can shed light what’s going on:

As you suggested, I was tampering with the hash at first, trying to make the build complain about the wrong hash. However, I did not replace with the correct hash right away (thank you for providing the command–very valuable to know!), but I changed only one character of it. And that did not trigger the expected behavior. I changed

sha256-zWOyPmaHRi2VIRvzFpS02tPlXNn90ogU2Q/YRx7l6eI=

to (trailing I to J)

sha256-zWOyPmaHRi2VIRvzFpS02tPlXNn90ogU2Q/YRx7l6eJ=

and the build does not detect it. :thinking: Same for IK :face_with_spiral_eyes:. Going I0 does cause the desired hash mismatch. :blush: Curious to understand this …

Anyways, stack.pop to the original task. Thank you again!

The easiest is to simply make the hash an empty string. Nixpkgs will replace it with an all 0s hash that is effectively always wrong.

2 Likes