I want to override the version of the vscode-js-debug package in nixos-24.11
from 1.94.0
to 1.76.1
.
My Approach
I’ve set up a flake.nix
and an overlay as follows:
./flake.nix
{
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
outputs = {nixpkgs, ...}: {
defaultPackage.x86_64-linux = let
pkgs = import nixpkgs {
overlays = [(import ./overlay.nix)];
system = "x86_64-linux";
};
in
pkgs.vscode-js-debug;
};
}
./overlay.nix
final: prev: {
vscode-js-debug = prev.vscode-js-debug.overrideAttrs (_: rec {
version = "1.76.1";
src = final.fetchFromGitHub {
owner = "microsoft";
repo = "vscode-js-debug";
rev = "v${version}";
hash = "sha256-YGMIzGcjQhz/H6DpxQSOwV6eXVNDXX7mFN56FejDcXo=";
};
npmDepsHash = "sha256-lDoj/94tjJd4ZGU9WgrMOqNSmdpeCljU4c6jGX+TSDY=";
});
}
The Problem
When I attempt to build, it fails with the following error:
ERROR: npmDepsHash is out of date
The package-lock.json in src is not the same as in /nix/store/h7zr17lmh19dpwgd8zjhnprp12x98by7-vscode-js-debug-1.94.0-npm-deps.
To fix the issue:
1. Use `lib.fakeHash` as the npmDepsHash value
2. Build the derivation and wait for it to fail with a hash mismatch
3. Copy the 'got: sha256-' value back into the npmDepsHash field
What I’ve Tried
- I set
npmDepsHash
tolib.fakeHash
as recommended. - After the build failed, I checked the logs, but I could not find the real hash.
- I used prefetch-npm-deps to calculate the
npmDepsHash
for thepackage-lock.json
of both versions (1.76.1
and1.94.0
):- The hash for
1.94.0
matches the one in the currentpackage.nix
.
- The hash for
Despite these steps, I still get the same error, and it appears to be fetching the original 1.94.0
version instead of 1.76.1
.
Question
How can I correctly override vscode-js-debug
to use version 1.76.1
?