From 5a02dc8ee81a50842892d6b0eb7a778af0ed5077 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Fri, 15 Jul 2022 15:53:01 -0700 Subject: [PATCH] nlohmann_json: allow overrides by eliminating use of `rec` The existing nlohmann_json expression prevents users from overriding fields (like `doCheck`) because it uses `rec` in the argument to `mkDerivation`. Let's use the shiny new pass-a-function-to-`mkDerivation` feature to do the same thing without blocking overrides. --- pkgs/development/libraries/nlohmann_json/default.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/nlohmann_json/default.nix b/pkgs/development/libraries/nlohmann_json/default.nix index 0e3fb180c8131d3..ec4df7927f2b62f 100644 --- a/pkgs/development/libraries/nlohmann_json/default.nix +++ b/pkgs/development/libraries/nlohmann_json/default.nix @@ -10,23 +10,23 @@ let rev = "v3.0.0"; sha256 = "O6p2PFB7c2KE9VqWvmTaFywbW1hSzAP5V42EuemX+ls="; }; -in stdenv.mkDerivation rec { +in stdenv.mkDerivation (finalAttrs: { pname = "nlohmann_json"; version = "3.10.5"; src = fetchFromGitHub { owner = "nlohmann"; repo = "json"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; sha256 = "DTsZrdB9GcaNkx7ZKxcgCA3A9ShM5icSF0xyGguJNbk="; }; nativeBuildInputs = [ cmake ]; cmakeFlags = [ - "-DBuildTests=${if doCheck then "ON" else "OFF"}" + "-DBuildTests=${if finalAttrs.doCheck then "ON" else "OFF"}" "-DJSON_MultipleHeaders=ON" - ] ++ lib.optional doCheck "-DJSON_TestDataDirectory=${testData}"; + ] ++ lib.optional finalAttrs.doCheck "-DJSON_TestDataDirectory=${testData}"; doCheck = stdenv.hostPlatform == stdenv.buildPlatform; @@ -44,4 +44,4 @@ in stdenv.mkDerivation rec { license = licenses.mit; platforms = platforms.all; }; -} +})