From ce9660cb142544ff3612bb2e39e2d2860a72dc5c Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Wed, 24 May 2023 18:30:45 -0700 Subject: [PATCH] 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. :/ --- Changelog | 1 + default.nix | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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 = { -- 2.44.1