Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to buildVars #60

Open
goldsborough opened this issue Feb 15, 2023 · 2 comments
Open

Add to buildVars #60

goldsborough opened this issue Feb 15, 2023 · 2 comments

Comments

@goldsborough
Copy link

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?

@stephank
Copy link
Owner

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.

@adrian-gierakowski
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants