diff options
Diffstat (limited to 'pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix')
-rw-r--r-- | pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix | 66 |
1 files changed, 31 insertions, 35 deletions
diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix index 5d562017b8f..f6d1ea5418f 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix @@ -3,48 +3,46 @@ , makeSetupHook , wheel , pip +, pkgs }: let callPackage = python.pythonForBuild.pkgs.callPackage; pythonInterpreter = python.pythonForBuild.interpreter; pythonSitePackages = python.sitePackages; + + nonOverlayedPython = pkgs.python3.pythonForBuild.withPackages (ps: [ ps.tomlkit ]); + makeRemoveSpecialDependenciesHook = { fields, kind }: + nonOverlayedPython.pkgs.callPackage + ( + {}: + makeSetupHook + { + name = "remove-path-dependencies.sh"; + deps = [ ]; + substitutions = { + # NOTE: We have to use a non-overlayed Python here because otherwise we run into an infinite recursion + # because building of tomlkit and its dependencies also use these hooks. + pythonPath = nonOverlayedPython.pkgs.makePythonPath [ nonOverlayedPython ]; + pythonInterpreter = nonOverlayedPython.interpreter; + pyprojectPatchScript = "${./pyproject-without-special-deps.py}"; + fields = fields; + kind = kind; + }; + } ./remove-special-dependencies.sh + ) + { }; in { + removePathDependenciesHook = makeRemoveSpecialDependenciesHook { + fields = [ "path" ]; + kind = "path"; + }; - removePathDependenciesHook = callPackage - ( - {}: - makeSetupHook - { - name = "remove-path-dependencies.sh"; - deps = [ ]; - substitutions = { - inherit pythonInterpreter; - yj = "${buildPackages.yj}/bin/yj"; - pyprojectPatchScript = "${./pyproject-without-special-deps.py}"; - fields = [ "path" ]; - kind = "path"; - }; - } ./remove-special-dependencies.sh - ) - { }; + removeGitDependenciesHook = makeRemoveSpecialDependenciesHook { + fields = [ "git" "branch" "rev" "tag" ]; + kind = "git"; + }; - removeGitDependenciesHook = callPackage - ({}: - makeSetupHook - { - name = "remove-git-dependencies.sh"; - deps = [ ]; - substitutions = { - inherit pythonInterpreter; - yj = "${buildPackages.yj}/bin/yj"; - pyprojectPatchScript = "${./pyproject-without-special-deps.py}"; - fields = [ "git" "branch" "rev" "tag" ]; - kind = "git"; - }; - } ./remove-special-dependencies.sh - ) - { }; pipBuildHook = callPackage ( @@ -89,6 +87,4 @@ in } ./wheel-unpack-hook.sh ) { }; - - } |