Where's the source code of buildNpmPackage?

Hey!

I’m still relatively new to nix, and I used buildNpmPackage to build a npm project I have. Now however I need to customize it a bit more, but buildNpmPackage is pretty much a blackbox for me, so I wanted to look at the source of it. But I cannot find it, I can find lots of uses of buildNpmPackage, but not where it’s defined.

I’m sure it’s just that I’m not familiar enough yet with the structure of nixpkgs, but could someone point me to the source for it?

Thank you!

It’s here: https://github.com/NixOS/nixpkgs/blob/7b5e394e7573b5b364e332a38653ee015b498817/pkgs/build-support/node/build-npm-package/default.nix

3 Likes

I wanted to add that this link is also now mentioned in the Wiki at Node.js - NixOS Wiki
as the link by @TLATER (many thanks) was the only other quick way to find the source code via search engines.

Please add links to other packaging wrappers source code into the Wiki and Guides as well, as this is sometimes the only way to debug (by seeing what happens under the hood).

2 Likes

grepping in a local clone is usually the easiest way to find these

$ rg 'buildNpmPackage ='  
pkgs/top-level/all-packages.nix
10068:  buildNpmPackage = callPackage ../build-support/node/build-npm-package { };

Hopefully as more packages move to pkgs/by-name, then all-packages.nix can become small enough to get indexed by github