Updating a nix package - first try help needed

I am following this guide on the wiki: https://nixos.wiki/wiki/Update_a_package with the goal of updating an existing nix package to a newer version. In this case, it’s deno (in nixpkgs/pkgs/development/web/deno). I’m doing this with my fork of the NixOS/nixpkgs repo.

I updated the default.nix file, with the diff being the following (I know that my hashes are probably wrong at this point):

$ git diff
index e3e7481dff1..944cb0887ce 100644
--- a/pkgs/development/web/deno/default.nix
+++ b/pkgs/development/web/deno/default.nix
@@ -17,15 +17,15 @@

 rustPlatform.buildRustPackage rec {
   pname = "deno";
-  version = "1.29.4";
+  version = "1.30.0";

   src = fetchFromGitHub {
     owner = "denoland";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-oCBtqOm/d5dpIv70/Ht0M6izxdvm59LCiDHgcMcwLek=";
+    sha256 = "sha256-lPgVivYsR3SljPkjRRkb3qM3ZO7RALfk1KGPd7cwSYQ=";
   };
-  cargoSha256 = "sha256-Y/1yfCeWleNrk5MgkIoAtkH8e6YSZWa+GF5RgLaZXQA=";
+  cargoSha256 = "sha256-SLCtBizFwDQRkQplkjVT7fRwqezXe2DYEWnuwlb+fR0=";

   postPatch = ''
     # upstream uses lld on aarch64-darwin for faster builds

Then when I try to build, I get this:

trying https://github.com/denoland/deno/archive/v1.30.0.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100 18.7M  100 18.7M    0     0  14.1M      0  0:00:01  0:00:01 --:--:-- 26.8M
unpacking source archive /build/v1.30.0.tar.gz
error: hash mismatch in fixed-output derivation '/nix/store/r0yr1xgwszd0ayafjji749lf0vsz81an-source.drv':
         specified: sha256-lPgVivYsR3SljPkjRRkb3qM3ZO7RALfk1KGPd7cwSYQ=
            got:    sha256-He8RgzmiL8Zp+klm0JPNeqbyjK/5CsE7HB2Hco7GZss=
error: 1 dependencies of derivation '/nix/store/9yb1xyr3i2h678vib31ccvy06iwm7wc1-deno-1.30.0.drv' failed to build

Which is what I would expect. So I took the “got” hash and place it in default.nix and try again. Here’s the new diff:

$ git diff
diff --git a/pkgs/development/web/deno/default.nix b/pkgs/development/web/deno/default.nix
index e3e7481dff1..fe3cc76224c 100644
--- a/pkgs/development/web/deno/default.nix
+++ b/pkgs/development/web/deno/default.nix
@@ -17,15 +17,15 @@

 rustPlatform.buildRustPackage rec {
   pname = "deno";
-  version = "1.29.4";
+  version = "1.30.0";

   src = fetchFromGitHub {
     owner = "denoland";
     repo = pname;
     rev = "v${version}";
-    sha256 = "sha256-oCBtqOm/d5dpIv70/Ht0M6izxdvm59LCiDHgcMcwLek=";
+    sha256 = "sha256-He8RgzmiL8Zp+klm0JPNeqbyjK/5CsE7HB2Hco7GZss=";
   };
-  cargoSha256 = "sha256-Y/1yfCeWleNrk5MgkIoAtkH8e6YSZWa+GF5RgLaZXQA=";
+  cargoSha256 = "sha256-SLCtBizFwDQRkQplkjVT7fRwqezXe2DYEWnuwlb+fR0=";

   postPatch = ''
     # upstream uses lld on aarch64-darwin for faster builds

Then I re-run nix-build and get:

$ nix-build -A deno
checking for references to /build/ in /nix/store/74ifp46xsizpm1pghrlsi81hq4q9mmjd-deno-1.30.0-vendor.tar.gz...
patching script interpreter paths in /nix/store/74ifp46xsizpm1pghrlsi81hq4q9mmjd-deno-1.30.0-vendor.tar.gz
strip is /nix/store/iiq295j1z4q1sxmdbrl2j8ma3l5ns4wr-gcc-wrapper-11.3.0/bin/strip
error: hash mismatch in fixed-output derivation '/nix/store/ndiy7l9hs155prskm0m966qz5byahj9f-deno-1.30.0-vendor.tar.gz.drv':
         specified: sha256-SLCtBizFwDQRkQplkjVT7fRwqezXe2DYEWnuwlb+fR0=
            got:    sha256-lPgVivYsR3SljPkjRRkb3qM3ZO7RALfk1KGPd7cwSYQ=
error: 1 dependencies of derivation '/nix/store/afh3synnzni3rry2raiy6xysvdal978n-deno-1.30.0.drv' failed to build

So now it’s referring to the hash I used in the first place. If I change it to that, it it just cycles between the two hashes and I’m stuck.

I tried running:

nix-store --gc

That did not seem to help.

Is there some left over files that are causing this that I need to clean up?

now the hash it’s complaining about isn’t the hash of the fetched sources files though but of the vendored dependencies, i.e. cargoSha256. if you change that one to the second got it’ll build.

That was it, thank you.

proteus:~/src/nix/nixpkgs$ nix-env -f . -iA deno
replacing old 'deno-1.29.4'
installing 'deno-1.30.0'
building '/nix/store/yrxwly41i830j0n3y9sg8cg0x5477f7m-user-environment.drv'...
proteus:~/src/nix/nixpkgs$ deno --version
deno 1.30.0 (release, x86_64-unknown-linux-gnu)
v8 10.9.194.5
typescript 4.9.4