fix: pull in hooks directly instead of sneaking them in through pythonPackages

This does technically break people that override hooks, but they deserve it.
This commit is contained in:
K900 2022-10-28 00:40:18 +03:00
parent 3b9040d19e
commit 2c5c418746
3 changed files with 14 additions and 15 deletions

View file

@ -223,9 +223,6 @@ lib.makeScope pkgs.newScope (self: {
[ [
( (
self: super: self: super:
let
hooks = self.callPackage ./hooks { };
in
{ {
mkPoetryDep = self.callPackage ./mk-poetry-dep.nix { mkPoetryDep = self.callPackage ./mk-poetry-dep.nix {
inherit lib python poetryLib evalPep508; inherit lib python poetryLib evalPep508;
@ -236,8 +233,6 @@ lib.makeScope pkgs.newScope (self: {
poetry = poetryPkg; poetry = poetryPkg;
__toPluginAble = toPluginAble self; __toPluginAble = toPluginAble self;
inherit (hooks) pipBuildHook removePathDependenciesHook removeGitDependenciesHook poetry2nixFixupHook wheelUnpackHook;
} // lib.optionalAttrs (! super ? setuptools-scm) { } // lib.optionalAttrs (! super ? setuptools-scm) {
# The canonical name is setuptools-scm # The canonical name is setuptools-scm
setuptools-scm = super.setuptools_scm; setuptools-scm = super.setuptools_scm;
@ -375,6 +370,8 @@ lib.makeScope pkgs.newScope (self: {
}; };
py = poetryPython.python; py = poetryPython.python;
hooks = py.pkgs.callPackage ./hooks { };
inherit (poetryPython) pyProject; inherit (poetryPython) pyProject;
specialAttrs = [ specialAttrs = [
"overrides" "overrides"
@ -391,8 +388,8 @@ lib.makeScope pkgs.newScope (self: {
app = py.pkgs.buildPythonPackage ( app = py.pkgs.buildPythonPackage (
passedAttrs // inputAttrs // { passedAttrs // inputAttrs // {
nativeBuildInputs = inputAttrs.nativeBuildInputs ++ [ nativeBuildInputs = inputAttrs.nativeBuildInputs ++ [
py.pkgs.removePathDependenciesHook hooks.removePathDependenciesHook
py.pkgs.removeGitDependenciesHook hooks.removeGitDependenciesHook
]; ];
} // { } // {
pname = normalizePackageName pyProject.tool.poetry.name; pname = normalizePackageName pyProject.tool.poetry.name;

View file

@ -89,6 +89,8 @@ pythonPackages.callPackage
}; };
format = if isDirectory || isGit || isUrl then "pyproject" else fileInfo.format; format = if isDirectory || isGit || isUrl then "pyproject" else fileInfo.format;
hooks = python.pkgs.callPackage ./hooks { };
in in
buildPythonPackage { buildPythonPackage {
pname = normalizePackageName name; pname = normalizePackageName name;
@ -103,18 +105,18 @@ pythonPackages.callPackage
dontStrip = format == "wheel"; dontStrip = format == "wheel";
nativeBuildInputs = [ nativeBuildInputs = [
pythonPackages.poetry2nixFixupHook hooks.poetry2nixFixupHook
] ]
++ lib.optional (!isSource && (getManyLinuxDeps fileInfo.name).str != null) autoPatchelfHook ++ lib.optional (!isSource && (getManyLinuxDeps fileInfo.name).str != null) autoPatchelfHook
++ lib.optionals (format == "wheel") [ ++ lib.optionals (format == "wheel") [
pythonPackages.wheelUnpackHook hooks.wheelUnpackHook
pythonPackages.pipInstallHook pythonPackages.pipInstallHook
pythonPackages.setuptools pythonPackages.setuptools
] ]
++ lib.optionals (format == "pyproject") [ ++ lib.optionals (format == "pyproject") [
pythonPackages.removePathDependenciesHook hooks.removePathDependenciesHook
pythonPackages.removeGitDependenciesHook hooks.removeGitDependenciesHook
pythonPackages.pipBuildHook hooks.pipBuildHook
]; ];
buildInputs = ( buildInputs = (

View file

@ -5,10 +5,10 @@
"homepage": "https://github.com/NixOS/nixpkgs", "homepage": "https://github.com/NixOS/nixpkgs",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "37bd39839acf99c5b738319f42478296f827f274", "rev": "5bdb380ee7fa036d47b19e9d854928f4881c50a1",
"sha256": "1w7xby2paqgn4w1pkv0hr44xywlidmw3nq42naq6g3i3cni33hj3", "sha256": "0jqvam3kpxwi6qq8w06f8l4l4s3dj5cvx79p48v9pjiij27kavxq",
"type": "tarball", "type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/37bd39839acf99c5b738319f42478296f827f274.tar.gz", "url": "https://github.com/NixOS/nixpkgs/archive/5bdb380ee7fa036d47b19e9d854928f4881c50a1.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz" "url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
} }
} }