poetry2nix icon indicating copy to clipboard operation
poetry2nix copied to clipboard

netrc FileNotFoundError for private PyPI server

Open danielgafni opened this issue 1 year ago • 17 comments

Describe the issue

Hello!

There is a weird error I'm getting when trying to use the netrc file to access a private PyPI server:

Traceback (most recent call last):
  File "/nix/store/ipfjy7lra1hdl6yrpfidsjip4rndmlz1-fetch_from_legacy.py", line 50, in <module>
    netrc_obj = netrc.netrc(os.environ["NETRC"])
  File "/nix/store/95cxzy2hpizr23343b8bskl4yacf4b3l-python3-3.10.11/lib/python3.10/netrc.py", line 30, in __init__
    with open(file, encoding="utf-8") as fp:
FileNotFoundError: [Errno 2] No such file or directory: '/etc/nix/.netrc'

The file clearly exists (and has correct permissions according to this readme). The command I'm running is:

 nix-shell -I NETRC=/etc/nix/.netrc --option extra-sandbox-paths /etc/nix

I realize the issue is probably not with poetry2nix, but I'm not sure how to proceed further...

Additional context

default.nix/shell.nix/flake.nix:

{ pkgs ? import <nixpkgs> {} }:
let
  myAppEnv = pkgs.poetry2nix.mkPoetryEnv {
    python=pkgs.python310;
    projectDir = ./.;
    preferWheels = true;
    editablePackageSources = {
      my-app = ./my_app;
    };
    overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend
                (self: super: {
                  wave = super.wave.overridePythonAttrs (old: {
                    nativeBuildInputs = (old.nativeBuildInputs or [ ])
                      ++ [ self.setuptools ];
                  });
                });

  };
in myAppEnv.env.overrideAttrs (oldAttrs: {
  buildInputs = [ pkgs.python310Packages.wheel pkgs.python310Packages.setuptools ];
})

danielgafni avatar Jul 24 '23 12:07 danielgafni