stephank / yarn-plugin-nixify

Yarn v3/v4 plugin to help with Nix packaging

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add to buildVars

goldsborough opened this issue · comments

I need to set an environment variable (npm auth token) required to fetch dependencies of my project. Is there a way for me to add to buildVars here to accomplish this?

This is tricky, because simply placing them in the environment via buildVars or similar results in Nix placing those credentials in /nix/store with world-readable permissions.

What might work is an option to set impureEnvVars for the fetch steps. That'd cause Nix to simply forward those environment variables. Downside is that most Nix installs are likely using nix-daemon to run builds, so the environment variables would have to be set on nix-daemon.

commented

I’ve added support for private npm registry and GitHub repos in my fork

it works with nix daemon
You’ll need to put the required credentials into files accessible to the daemon and add them to extra-sandbox-paths

The only other way I know is to run a proxy and inject the credentials into the requests made by the daemon