@@ -1,4 +1,4 @@
1−{ pkgs, nodejs, stdenv, fetchFromGitHub }:
1+{ pkgs, nodejs, stdenv, applyPatches, fetchFromGitHub, fetchpatch }:
22
33let
44 since = (version: pkgs.lib.versionAtLeast nodejs.version version);
@@ -191,6 +191,31 @@ let
191191
192192 node2nix = super.node2nix.override {
193193 buildInputs = [ pkgs.makeWrapper ];
194+ # We need to apply a patch to the source, but buildNodePackage doesn't allow patches.
195+ # So we pin the patched commit instead. The commit actually contains two other newer commits
196+ # since the last (1.9.0) release, but actually this is a good thing since one of them is a
197+ # Hydra-specific fix.
198+ src = applyPatches {
199+ src = fetchFromGitHub {
200+ owner = "svanderburg";
201+ repo = "node2nix";
202+ rev = "node2nix-1.9.0";
203+ sha256 = "0l4wp1131nhl9c14cn8bwawb8f77h1nfbnswgi5lp5m3kzkb27jn";
204+ };
205+
206+ patches = [
207+ # remove node_ name prefix
208+ (fetchpatch {
209+ url = "https://github.com/svanderburg/node2nix/commit/b54d45207427ff46e90f16f2f32771fdc8bff5a4.patch";
210+ sha256 = "03cg2xwryvdlvg299dg91qxicrw2r43grja80an9zkb875ps8jxh";
211+ })
212+ # set meta platform
213+ (fetchpatch {
214+ url = "https://github.com/svanderburg/node2nix/commit/58736093161f2d237c17e75a96529b018cd0ac64.patch";
215+ sha256 = "1c91qfqa6p4hzyafv5pq6rpgnny2805n007b1443gbqwrz5awz6n";
216+ })
217+ ];
218+ };
194219 postInstall = ''
195220 wrapProgram "$out/bin/node2nix" --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.nix ]}
196221 '';