diff --git a/pkgs/by-name/ma/maven/package.nix b/pkgs/by-name/ma/maven/package.nix index f7d88548f36b..543949398760 100644 --- a/pkgs/by-name/ma/maven/package.nix +++ b/pkgs/by-name/ma/maven/package.nix @@ -6,7 +6,6 @@ makeWrapper, stdenvNoCC, }: - stdenvNoCC.mkDerivation (finalAttrs: { pname = "maven"; version = "3.9.9"; @@ -34,14 +33,31 @@ stdenvNoCC.mkDerivation (finalAttrs: { runHook postInstall ''; - passthru = { - buildMaven = callPackage ./build-maven.nix { - maven = finalAttrs.finalPackage; + passthru = + let + makeOverridableMavenPackage = + mavenRecipe: mavenArgs: + let + drv = mavenRecipe mavenArgs; + overrideWith = + newArgs: mavenArgs // (if lib.isFunction newArgs then newArgs mavenArgs else newArgs); + in + drv + // { + overrideMavenAttrs = newArgs: makeOverridableMavenPackage mavenRecipe (overrideWith newArgs); + }; + in + { + buildMaven = callPackage ./build-maven.nix { + maven = finalAttrs.finalPackage; + }; + + buildMavenPackage = makeOverridableMavenPackage ( + callPackage ./build-maven-package.nix { + maven = finalAttrs.finalPackage; + } + ); }; - buildMavenPackage = callPackage ./build-maven-package.nix { - maven = finalAttrs.finalPackage; - }; - }; meta = { homepage = "https://maven.apache.org/";