-
Notifications
You must be signed in to change notification settings - Fork 100
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
Usage with private NPM packages? #151
Comments
Currently there isn't. I actually don't use private NPM packages myself, but it would definitely be an interesting feature to have, but this is something that needs to be investigated. |
Thank you for the quick response! |
This worked for me: let
netrc = builtins.path { name = "netrc"; path = ~/.netrc; };
fetchurlPrivate = opts: fetchurl (opts // {
curlOpts = "${opts.curlOpts or ""} --netrc-file ${netrc}";
});
nodeEnv = import ./default.nix {
inherit pkgs;
fetchurl = fetchurlPrivate;
};
in nodeEnv.shell Put your usernames/passwords in |
Good suggestion, does the .netrc file also need to be included as |
@bobvanderlinden No need! |
@lionello I will try this out soon. Thank you for responding |
How do you get |
@locallycompact I used a |
Placed where, used how? |
@lionello If I have a |
Sorry, I meant
I also noticed that export NIX_PATH="ssh-config-file=/etc/ssh/ssh_config:ssh-auth-sock=$SSH_AUTH_SOCK:$NIX_PATH" |
I would also find this feature very useful. |
https://nixos.wiki/wiki/Enterprise has some relevant info on how to instruct Nix builds to use creds found in |
@lionello in your solution the netrc file ends up being copied to nix-store, doesn't it? In which case it's not secure |
Yeah you're right. Nowadays you should be able to use |
This is still an issue. If you try to use |
I ended up with the following hack. In my case I wanted to build a private npm package that depended upon private npm packages, all located on GitHub packages. I first ran --registry https://registry.npmjs.org \
--registry https://npm.pkg.github.com \
--registry-auth-token "$token" \
--registry-scope @my-scope This generates To avoid changing any of these generated files, I replaced nixpkgs' nodeEnv = import ./default.nix {
pkgs = pkgs // {
fetchurl =
let
otherFetchurl = import <nix/fetchurl.nix>;
in
args: pkgs.runCommand "custom-fetched-${args.url}" { } ''
mkdir $out
cd $out
tar --strip-components=1 -xf ${otherFetchurl args}
'';
};
nodejs = pkgs.nodejs;
}; |
Hi, thanks for the work here! I'm somewhat familiar with nix but definitely am new to this project and was trying to see if there's a current solution for working with private NPM packages?
Thank you!
The text was updated successfully, but these errors were encountered: