npmDepsHash override, what am I missing please

You can’t override npmDepsHash that way, overrideAttrs only applies to args of mkDerivation, not the args of other builders.

    netbird-dashboard = prev.netbird-dashboard.overrideAttrs (_old: rec {
      pname = "netbird-dashboard";
      version = "2.5.0";
      src = final.fetchFromGitHub {
        owner = "netbirdio";
        repo = "dashboard";
        rev = "v${version}";
        hash = "sha256-PissALQ/3gARnm2hiURABFqF2OKkFITMKf2Rww56hEM=";
      };
      npmDepsHash = "";
      npmDeps = final.fetchNpmDeps {
        inherit src;
        name = "${pname}-${version}-npm-deps";
        hash = npmDepsHash;
      };
    });

Build that and get your hash.

Couple other points:

  • You seem to be writing an overlay, always prefer final over prev unless it’s unavoidable to use prev (due to infrec)
  • Avoid overlays, if you can, just use the override in-place for leaf packages
  • If the following attrs were defined in the original expression, you’d also want to put inherit (_old) forceGitDeps forceEmptyCache sourceRoot prePatch patches postPatch; in the fetchNpmDeps call (though in this case, none of them are defined, I think.)
5 Likes