buildNpmPackages and private NPM repos?

Hi! I’m using Nix in my GitHub workflows at my company to build a product that involves (a) a NextJS app and (b) an internal NPM package, hosted at GitHub NPM packages (npm.pkg.github.com)

I’m trying to use buildNpmPackage to do the heavy lifting, but I can’t seem to successfully get my project’s .npmrc file (which specifies auth for the repo) to be respected.

Are there any examples of how to use buildNpmPackage with a private NPM repo? What’s the best practice here?

:wave: @1attice

I am stumbling through packaging things using buildNpmPackage and so may be able to provide advice.

Can you share a simplified snippet of your packaging attempt? I see this as simple nix expression as demonstrated in “Steps to Reproduce” in buildNpmPackage fails to build git dependencies · Issue #240243 · NixOS/nixpkgs · GitHub.

Or, a simplified flake would be great.

I struggled with the same issue. What ended up working was putting the following in my nixos configuration:
systemd.services.nix-daemon.serviceConfig.Environment = [
‘‘NIX_NPM_TOKENS={"registry.tiptap.dev":"MY-API-TOKEN"}’’
];

This allowed me to use a private npm registry when building my npm based project using buildNpmPackage.

1 Like