yarn-plugin-nixify icon indicating copy to clipboard operation
yarn-plugin-nixify copied to clipboard

Add to buildVars

Open goldsborough opened this issue 3 years ago • 2 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?

goldsborough avatar Feb 15 '23 03:02 goldsborough

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.

stephank avatar Feb 15 '23 08:02 stephank

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

adrian-gierakowski avatar Feb 15 '23 09:02 adrian-gierakowski