Hi,
I am trying to set up uv2nix to manage fetching and building my python project from within a Nix flake. Some of my dependencies are hosted on a private Git instance, which requires authentication using a developer specific API-token and user id. The issue is figuring out how to pass this token to the flake.
The documentation for uv2nix lists a recommended way to do this by passing the netrc-file to curl, like so:
manualOverrides = final: prev: {
internally-hosted-py-lib = prev.internally-hosted-py-lib.overrideAttrs(old: {
src = old.src.overrideAttrs(_: {
curlOpts = "--netrc-file /etc/nix/.netrc";
SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
});
});
};
However, even when running nix develop with the option --option extra-sandbox-paths /etc/nix/.netrc as the documentation states, this fails with the error:
trying https://git.domain.tld/api/…/internally-hosted-py-lib.whl
curl: (26) .netrc error: no such file
Attempting to pass .netrc to the flake through extra-sandbox-paths gives an immediate error:
error:
… while setting up the build environment
error: getting status of "/home/fkedi/.netrc": Permission denied
This failing, I tried passing the credentials directly to curl, using the switch -u name:token, and passing the name and token in through environment variables - but that fails, since Nix flakes simply return empty strings when attempting to read environment variables. If this token was simply a single token shared between the entire team, we could probably use a tool like agenix to safely share the secret, but each developer has their own token that needs to be used automatically.
If anyone has any insight into what might be causing this issue, I would be very appreciative of any help.
And just for transparency: I posted yesterday about this same issue, but I had buried the fact that this was a uv2nix issue in the replies (since I thought it was an issue unrelated to that), and so I was recommended by another user to create a new post that clearly stated this, so that the people with the right knowledge are more likely to find it.
Edit: updated for clarity between two separate issues.