fetch-node-modules: provide CA certs

Without this, the `npm ci` command in `fetchNodeModules` hangs.

It seems that npm didn't check certs previously, because these are
not availble in Nix build environments by default.
This commit is contained in:
Erik Arvstedt 2023-12-02 23:26:52 +01:00
parent 770a4354b4
commit b110e2aea6
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -1,7 +1,7 @@
# This is a modified version of
# https://github.com/NixOS/nixpkgs/pull/128749
{ lib, stdenvNoCC, makeWrapper, nodejs }:
{ lib, stdenvNoCC, makeWrapper, nodejs, cacert }:
{ src
, hash ? ""
@ -25,6 +25,9 @@ stdenvNoCC.mkDerivation ({
phases = "unpackPhase patchPhase buildPhase installPhase";
# npm doesn't support var `SSL_CERT_FILE`.
NODE_EXTRA_CA_CERTS = "${cacert}/etc/ssl/certs/ca-bundle.crt";
buildPhase = ''
runHook preBuild