From 5504973e0cc4f8f7d10c8871d67e6cf199e31092 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 10 Aug 2024 19:06:38 +0200 Subject: [PATCH] php.extensions.blackfire: assert supported version Otherwise, it will fail later on attribute access, which cannot be caught with `builtins.tryEval`. This is presumably important to avoid having CI fail on new PHP versions not yet supported by blackfire. --- .../development/tools/misc/blackfire/php-probe.nix | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkgs/development/tools/misc/blackfire/php-probe.nix b/pkgs/development/tools/misc/blackfire/php-probe.nix index 5a49201a8ffb..8ec0fcac05f9 100644 --- a/pkgs/development/tools/misc/blackfire/php-probe.nix +++ b/pkgs/development/tools/misc/blackfire/php-probe.nix @@ -13,6 +13,7 @@ assert lib.assertMsg (!php.ztsSupport) "blackfire only supports non zts versions let phpMajor = lib.versions.majorMinor php.version; + inherit (stdenv.hostPlatform) system; version = "1.92.21"; @@ -68,14 +69,16 @@ let hash = hashes.${system}.hash.${phpMajor}; }; in + +assert lib.assertMsg (hashes ? ${system}.hash.${phpMajor}) "blackfire does not support PHP version ${phpMajor} on ${system}."; + stdenv.mkDerivation (finalAttrs: { pname = "php-blackfire"; extensionName = "blackfire"; inherit version; src = makeSource { - system = stdenv.hostPlatform.system; - inherit phpMajor; + inherit system phpMajor; }; nativeBuildInputs = lib.optionals stdenv.isLinux [ @@ -122,15 +125,12 @@ stdenv.mkDerivation (finalAttrs: { (finalAttrs.finalPackage.overrideAttrs (attrs: { src = makeSource sourceParams; })); - - # Filter out all attributes other than hashes. - hashesOnly = lib.filterAttrsRecursive (name: _value: name != "system") hashes; in lib.concatMapAttrs ( system: - { hashes, ... }: + { hash, ... }: - lib.mapAttrs' (phpMajor: _hash: createUpdateable { inherit phpMajor system; }) + lib.mapAttrs' (phpMajor: _hash: createUpdateable { inherit phpMajor system; }) hash ) hashes; };