about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix')
-rw-r--r--nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix16
1 files changed, 12 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix b/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
index cb1cd8af1316..8e9dee865a54 100644
--- a/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
+++ b/nixpkgs/pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
@@ -137,6 +137,13 @@ let
 
   fetchFromLegacy = lib.makeOverridable (
     { python, pname, url, file, hash }:
+    let
+      pathParts =
+        (builtins.filter
+          ({ prefix, path }: "NETRC" == prefix)
+          builtins.nixPath);
+      netrc_file = if (pathParts != [ ]) then (builtins.head pathParts).path else "";
+    in
     pkgs.runCommand file
       {
         nativeBuildInputs = [ python ];
@@ -144,6 +151,7 @@ let
         outputHashMode = "flat";
         outputHashAlgo = "sha256";
         outputHash = hash;
+        NETRC = netrc_file;
       } ''
       python ${./fetch_from_legacy.py} ${url} ${pname} ${file}
       mv ${file} $out
@@ -174,11 +182,11 @@ let
     lib.optionals (builtins.toString path != "/" && ! isGitRoot) (findGitIgnores parent) ++ gitIgnores;
 
   /*
-  Provides a source filtering mechanism that:
+    Provides a source filtering mechanism that:
 
-  - Filters gitignore's
-  - Filters pycache/pyc files
-  - Uses cleanSourceFilter to filter out .git/.hg, .o/.so, editor backup files & nix result symlinks
+    - Filters gitignore's
+    - Filters pycache/pyc files
+    - Uses cleanSourceFilter to filter out .git/.hg, .o/.so, editor backup files & nix result symlinks
   */
   cleanPythonSources = { src }:
     let