From: Scott Worley Date: Thu, 25 May 2023 01:30:45 +0000 (-0700) Subject: Adapt to nixpkgs' nativeCheckInputs change X-Git-Tag: v1.4.3~1 X-Git-Url: http://git.scottworley.com/git-cache/commitdiff_plain/ce9660cb142544ff3612bb2e39e2d2860a72dc5c?ds=sidebyside;hp=7a5602a89702788c4e5a870c1548ba226cc34e07 Adapt to nixpkgs' nativeCheckInputs change nixpkgs commit f39abbc3500451fc00c80fed71b0f6f7bba8b6a4, first released in 23.05, requires that everyone move their checkInputs to nativeCheckInputs. To build both before and after this change, we detect whether we're before or after this change by reading the manual & behave appropriately. :/ --- diff --git a/Changelog b/Changelog index 1336a09..12a866b 100644 --- a/Changelog +++ b/Changelog @@ -1,6 +1,7 @@ ## [Unreleased] ### Changed - Specify license +- Adapt to nixpkgs nativeCheckInputs change ## [1.4.2] - 2022-11-23 diff --git a/default.nix b/default.nix index a161d41..d233700 100644 --- a/default.nix +++ b/default.nix @@ -1,13 +1,19 @@ { pkgs ? import { }, lint ? false }: -pkgs.python3Packages.callPackage +let + checkInputsAreNative = pkgs.lib.hasInfix "nativeCheckInputs" + (builtins.readFile ); + checkInputsName = + if checkInputsAreNative then "nativeCheckInputs" else "checkInputs"; +in pkgs.python3Packages.callPackage ({ lib, buildPythonPackage, nix, git, backoff, autopep8, mypy, pylint, }: buildPythonPackage rec { pname = "git-cache"; version = "1.4.2"; src = lib.cleanSource ./.; propagatedBuildInputs = [ backoff ]; - checkInputs = [ nix git mypy ] ++ lib.optionals lint [ autopep8 pylint ]; + "${checkInputsName}" = [ nix git mypy ] + ++ lib.optionals lint [ autopep8 pylint ]; doCheck = true; checkPhase = "./test.sh"; meta = {