diff --git a/src/subsystems/php/builders/granular-php/default.nix b/src/subsystems/php/builders/granular-php/default.nix index f53f771f..0fc70f13 100644 --- a/src/subsystems/php/builders/granular-php/default.nix +++ b/src/subsystems/php/builders/granular-php/default.nix @@ -89,6 +89,7 @@ # Generates a derivation for a specific package name + version makeOnePackage = name: version: let + packageType = subsystemAttrs.phpPackageType."${name}@${version}"; dependencies = getDependencies name version; repositories = let transform = dep: let @@ -127,7 +128,12 @@ inherit (dep) name; value = dep.version; }) - dependencies + (dependencies + ++ l.optional (subsystemAttrs.composerPluginApiSemver ? "${name}@${version}") + { + name = "composer-plugin-api"; + version = subsystemAttrs.composerPluginApiSemver."${name}@${version}"; + }) )); versionString = diff --git a/src/subsystems/php/translators/composer-lock/default.nix b/src/subsystems/php/translators/composer-lock/default.nix index 64fccf67..d12863f9 100644 --- a/src/subsystems/php/translators/composer-lock/default.nix +++ b/src/subsystems/php/translators/composer-lock/default.nix @@ -117,6 +117,19 @@ in { in map (l.removePrefix "ext-") extensions; + composerPluginApiSemver = l.listToAttrs (l.flatten (map + ( + pkg: let + requires = getRequire pkg; + in + l.optional (requires ? "composer-plugin-api") + { + name = "${pkg.name}@${pkg.version}"; + value = requires."composer-plugin-api"; + } + ) + packages)); + # get cleaned pkg attributes getRequire = pkg: l.mapAttrs @@ -204,7 +217,7 @@ in { clean = requires: l.filterAttrs (name: _: - !(l.elem name ["php" "composer/composer" "composer-runtime-api"]) + !(l.elem name ["php" "composer-plugin-api" "composer-runtime-api"]) && !(l.strings.hasPrefix "ext-" name)) requires; doPin = name: semver: @@ -236,6 +249,7 @@ in { # ./src/specifications/{subsystem} subsystemAttrs = { inherit phpSemver phpExtensions; + inherit composerPluginApiSemver; }; # name of the default package