node2nix icon indicating copy to clipboard operation
node2nix copied to clipboard

Can't `nix-build` with private package?

Open muni-corn opened this issue 3 years ago • 1 comments

Hi! I'm trying to run nix-build after successfully running node2nix --registry ... --registry-auth-token ..., but am getting a 404 when fetchurl tries to fetch the private npm package during nix-build:

error: builder for '/nix/store/bdj4iaxkhb2zyjj4b03jydbvh2y0w4x3-private-package-1.0.3.tgz.drv' failed with exit code 1;
       last 7 log lines:
       >
       > trying https://registry.npmjs.org/@private-org/private-package/-/private-package-1.0.3.tgz
       >   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
       >                                  Dload  Upload   Total   Spent    Left  Speed
       >   0    21    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
       > curl: (22) The requested URL returned error: 404
       > error: cannot download private-package-1.0.3.tgz from any mirror
       For full logs, run 'nix log /nix/store/bdj4iaxkhb2zyjj4b03jydbvh2y0w4x3-private-package-1.0.3.tgz.drv'.
error: 1 dependencies of derivation '/nix/store/nqq6az64wrnm41x4i5gwgx8v4g0wx2q5-private-project-1.0.0.drv' failed to build

Is there a way to fix this?

muni-corn avatar Feb 06 '22 02:02 muni-corn

I don't use this feature (private repos) myself so I can't be much of help. However, I believe this problem can be solved by providing a .netrc configuration file. I think if you look at the fetchurl implementation in Nixpkgs, then you should probably find more information.

svanderburg avatar Apr 20 '22 14:04 svanderburg