From 2c5c418746a6a336c8540fb5a1073ce83eb85373 Mon Sep 17 00:00:00 2001 From: K900 Date: Fri, 28 Oct 2022 00:40:18 +0300 Subject: [PATCH] fix: pull in hooks directly instead of sneaking them in through pythonPackages This does technically break people that override hooks, but they deserve it. --- default.nix | 11 ++++------- mk-poetry-dep.nix | 12 +++++++----- nix/sources.json | 6 +++--- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/default.nix b/default.nix index ec19a3c..a92e74d 100644 --- a/default.nix +++ b/default.nix @@ -223,9 +223,6 @@ lib.makeScope pkgs.newScope (self: { [ ( self: super: - let - hooks = self.callPackage ./hooks { }; - in { mkPoetryDep = self.callPackage ./mk-poetry-dep.nix { inherit lib python poetryLib evalPep508; @@ -236,8 +233,6 @@ lib.makeScope pkgs.newScope (self: { poetry = poetryPkg; __toPluginAble = toPluginAble self; - - inherit (hooks) pipBuildHook removePathDependenciesHook removeGitDependenciesHook poetry2nixFixupHook wheelUnpackHook; } // lib.optionalAttrs (! super ? setuptools-scm) { # The canonical name is setuptools-scm setuptools-scm = super.setuptools_scm; @@ -375,6 +370,8 @@ lib.makeScope pkgs.newScope (self: { }; py = poetryPython.python; + hooks = py.pkgs.callPackage ./hooks { }; + inherit (poetryPython) pyProject; specialAttrs = [ "overrides" @@ -391,8 +388,8 @@ lib.makeScope pkgs.newScope (self: { app = py.pkgs.buildPythonPackage ( passedAttrs // inputAttrs // { nativeBuildInputs = inputAttrs.nativeBuildInputs ++ [ - py.pkgs.removePathDependenciesHook - py.pkgs.removeGitDependenciesHook + hooks.removePathDependenciesHook + hooks.removeGitDependenciesHook ]; } // { pname = normalizePackageName pyProject.tool.poetry.name; diff --git a/mk-poetry-dep.nix b/mk-poetry-dep.nix index 56c312f..9f7936d 100644 --- a/mk-poetry-dep.nix +++ b/mk-poetry-dep.nix @@ -89,6 +89,8 @@ pythonPackages.callPackage }; format = if isDirectory || isGit || isUrl then "pyproject" else fileInfo.format; + + hooks = python.pkgs.callPackage ./hooks { }; in buildPythonPackage { pname = normalizePackageName name; @@ -103,18 +105,18 @@ pythonPackages.callPackage dontStrip = format == "wheel"; nativeBuildInputs = [ - pythonPackages.poetry2nixFixupHook + hooks.poetry2nixFixupHook ] ++ lib.optional (!isSource && (getManyLinuxDeps fileInfo.name).str != null) autoPatchelfHook ++ lib.optionals (format == "wheel") [ - pythonPackages.wheelUnpackHook + hooks.wheelUnpackHook pythonPackages.pipInstallHook pythonPackages.setuptools ] ++ lib.optionals (format == "pyproject") [ - pythonPackages.removePathDependenciesHook - pythonPackages.removeGitDependenciesHook - pythonPackages.pipBuildHook + hooks.removePathDependenciesHook + hooks.removeGitDependenciesHook + hooks.pipBuildHook ]; buildInputs = ( diff --git a/nix/sources.json b/nix/sources.json index a9ee598..1d29a42 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -5,10 +5,10 @@ "homepage": "https://github.com/NixOS/nixpkgs", "owner": "NixOS", "repo": "nixpkgs", - "rev": "37bd39839acf99c5b738319f42478296f827f274", - "sha256": "1w7xby2paqgn4w1pkv0hr44xywlidmw3nq42naq6g3i3cni33hj3", + "rev": "5bdb380ee7fa036d47b19e9d854928f4881c50a1", + "sha256": "0jqvam3kpxwi6qq8w06f8l4l4s3dj5cvx79p48v9pjiij27kavxq", "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///archive/.tar.gz" } }