# Improving Maven Build Support in nixpkgs — Reproducible Thoughts

**URL:** https://discourse.nixos.org/t/improving-maven-build-support-in-nixpkgs-reproducible-thoughts/80702
**Category:** Links
**Created:** [October 23, 2026, 8:28am UTC](https://discourse.nixos.org/t/improving-maven-build-support-in-nixpkgs-reproducible-thoughts/80702 "2026-10-23T08:28:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![britter](https://discourse.nixos.org/user_avatar/discourse.nixos.org/britter/32/30382_2.png) [@britter](https://discourse.nixos.org/u/britter)
#### Post date: [October 23, 2026, 8:28am UTC](https://discourse.nixos.org/t/improving-maven-build-support-in-nixpkgs-reproducible-thoughts/80702/1 "2026-10-23T08:28:04Z")

</div>

> **[Improving Maven Build Support in nixpkgs — Reproducible Thoughts](https://britter.dev/blog/2026/10/23/maven-build-support-nixpkgs/)**
>
> How maven.buildMavenPackage works in nixpkgs, and a tour through its recent improvements: readable FOD logs, fixed-point evaluation with finalAttrs and finalPackage, and a maven\_4 hook.

---

<div class="post-metadata">

### Author: ![bitbloxhub](https://discourse.nixos.org/user_avatar/discourse.nixos.org/bitbloxhub/32/35210_2.png) [@bitbloxhub](https://discourse.nixos.org/u/bitbloxhub)
#### Post date: [October 23, 2026, 3:52pm UTC](https://discourse.nixos.org/t/improving-maven-build-support-in-nixpkgs-reproducible-thoughts/80702/2 "2026-10-23T15:52:34Z")

</div>

Isn’t `lib.extendMkDerivation` the recommended way to do `finalAttrs` and `finalPackage` support?

> <https://github.com/NixOS/nixpkgs/pull/498806>
>
> Feedback welcome. This is an attempt at making both buildFHSEnv and appimageTool…s.{wrapAppImage,wrapType2} support the finalAttrs pattern via lib.extendMkDerivation.
> 
> This is achieved by removing runCommand from buildFHSEnv and replace it with a "normal" mkDerivation that does the exact same thing (copied the implementation of runCommandWith), to be used in extendMkDerivation.
> 
> I have also made a somewhat breaking change to wrapAppImage: it now takes a \`contents\` argument instead of \`src\`, leaving src for the actual appimage file; overriding wouldn't work otherwise. (Potential TODO: emit a warning when contents is not specified? I don't think it would be a bad idea, I just don't really know how to do it)
> 
> \## Things done
> 
> 
> 
> \- Built on platform:
> - \[\] x86\_64-linux
> - \[\] aarch64-linux
> - \[\] x86\_64-darwin
> - \[\] aarch64-darwin
> \- Tested, as applicable:
> - \[\] \[NixOS tests\] in \[nixos/tests\].
> - \[\] \[Package tests\] at \`passthru.tests\`.
> - \[\] Tests in \[lib/tests\] or \[pkgs/test\] for functions and "core" functionality.
> \- \[\] Ran \`nixpkgs-review\` on this PR. See \[nixpkgs-review usage\].
> \- \[x\] Tested basic functionality of all binary files, usually in \`./result/bin/\`. (tested osu-lazer-bin)
> \- Nixpkgs Release Notes
> - \[x\] Package update: when the change is major or breaking.
> \- NixOS Release Notes
> - \[\] Module addition: when adding a new NixOS module.
> - \[\] Module update: when the change is significant.
> \- \[x\] Fits \[CONTRIBUTING.md\], \[pkgs/README.md\], \[maintainers/README.md\] and other READMEs.
> 
> \[NixOS tests\]: https://nixos.org/manual/nixos/unstable/index.html#sec-nixos-tests
> \[Package tests\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md#package-tests
> \[nixpkgs-review usage\]: https://github.com/Mic92/nixpkgs-review#usage
> 
> \[CONTRIBUTING.md\]: https://github.com/NixOS/nixpkgs/blob/master/CONTRIBUTING.md
> \[lib/tests\]: https://github.com/NixOS/nixpkgs/blob/master/lib/tests
> \[maintainers/README.md\]: https://github.com/NixOS/nixpkgs/blob/master/maintainers/README.md
> \[nixos/tests\]: https://github.com/NixOS/nixpkgs/blob/master/nixos/tests
> \[pkgs/README.md\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/README.md
> \[pkgs/test\]: https://github.com/NixOS/nixpkgs/blob/master/pkgs/test

> <https://github.com/NixOS/nixpkgs/issues/489490>
>
> \## Describe the problem 
> 
> Since #234651 was merged, many derivation builders hav…e been rebuilt using this excellent helper. This is great because it mostly unifies the API for builders, rather than the mostly ad-hoc mess before. This issue is for tracking the builders that are left.
> 
> This is for things that are shaped like so:
> \`\`\`nix
> let
> myBuilder = { arg1, arg2 }:
> stdenv.mkDerivation { inherit arg1 arg2; };
> in
> \#...
> \`\`\`
> 
> Would also be nice to add documentation when these builders are modified as well :). Either inline so that the documentation shows up on Noogle, or docs in the docs directory for the Nixpkgs reference. 
> 
> It is also generally recommended to move builders to their own separate file rather than having them inline, then just \`myBuilder = callPackage ./my-builder.nix { }\`.
> 
> \## Tracking
> 
> This list is incomplete.
> 
> \- \[x\] buildEnv #432957
> \- \[x\] symlinkJoin #489233
> \- \[x\] applyPatches #489874
> \- \[x\] requireFile #487780
> \- \[\] writeShellApplication #460420
> \- \[x\] writeTextFile #458888 #513709
> \- \[x\] buildFHSenv #498806
> \- \[x\] buildFHSEnvBubblewrap #498806
> \- \[x\] appimageTools.wrapAppImage #498806
> \- \[x\] appimageTools.wrapType2 #498806
> \- \[\] hunspell dict builders #453947 
> \- \[\] linux kernel builder #471118 
> \- \[\] \[buildLinux\](https://github.com/NixOS/nixpkgs/blob/3afdb93b9dec358bb6bb56f955205bceb8e5f7c1/pkgs/os-specific/linux/kernel/generic.nix)
> \- \[\] beamPackages.buildErlangMk
> \- \[\] beamPackages.buildMix
> \- \[\] beamPackages.buildRebar3
> \- \[\] beamPackages.buildHex
> \- \[\] \[erlang interpreter builder\](https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/erlang/generic-builder.nix)
> \- \[x\] mkKops #489533
> \- \[\] dotnetCorePackages.mkNugetDeps
> \- \[\] dotnetCorePackages.mkNugetSource
> \- \[\] dotnetCorePackages.buildDotnetGlobalTool
> \- \[\] dotnetCorePackages.buildDotnetModule
> \- \[\] python3Packages.mkPythonMetaPackage
> \- \[\] python3Packages.mkPythonEditablePackage
> \- \[\] ~~mkLLVMPackages~~
> \- \[\] agdaPackages.withPackages'
> \- \[\] agdaPackages.mkDerivation
> \- \[x\] ~~mkYarnPackage~~ #324246
> \- \[x\] ~~mkYarnModules~~ #324246
> \- \[\] mkRuby
> \- \[\] dockerTools.mkRootLayer
> \- \[\] dockerTools.mkPureLayer
> \- \[\] dockerTools.buildImage
> \- \[\] dockerTools.buildLayeredImage
> \- \[\] dockerTools.buildImageWithNixDb
> \- \[\] dockerTools.buildLayeredImageWithNixDb
> \- \[\] dockerTools.mergeDrvs
> \- \[\] dockerTools.buildNixShellImage
> \- \[\] mkSaneConfig
> \- \[\] mkTerraform
> \- \[\] replaceVarsWith
> \- \[\] replaceVars
> \- \[\] buildUBoot
> \- \[\] ociTools.buildContainer
> \- \[\] haskell.lib.buildStackProject
> \- \[\] buildArmTrustedFirmware
> \- \[\] vmTools.buildRPM
> \- \[\] srcOnly
> \- \[\] buildBazelPackage
> \- \[\] dhallPackages.buildDhallDirectoryPackage
> \- \[\] buildVscode
> \- \[\] dhallPackages.buildDhallGitHubPackage
> \- \[\] dhallPackages.buildDhallUrl
> \- \[\] releaseTools.debBuild
> \- \[\] releaseTools.mvnBuild
> \- \[\] releaseTools.rpmBuild
> \- \[\] rustPlatform.importCargoLock
> \- \[\] buildRustCrate
> \- \[\] buildNimPackage #561257
> \- \[\] buildMozillaMach
> \- \[\] buildFHSEnvChroot
> \- \[\] buildTeleport
> \- \[\] testers.testVersion
> \- \[\] testers.testBuildFailure'
> \- \[\] testers.lycheeLinkCheck
> \- \[\] testers.testEqualContents
> \- \[\] buildDartApplication
> \- \[\] buildEmscriptenPackage
> \- \[\] buildOptee
> \- \[\] buildHomeAssistantComponent
> \- \[\] buildRubyGem
> \- \[\] chromium.mkDerivation
> \- \[\] \[source electron builder\](https://github.com/NixOS/nixpkgs/blob/2f0fe97440a8015a027295eebbd208c39606e78b/pkgs/development/tools/electron/common.nix)
> \- \[\] \[binary electron builder\](https://github.com/NixOS/nixpkgs/blob/2f0fe97440a8015a027295eebbd208c39606e78b/pkgs/development/tools/electron/binary/generic.nix)
> \- \[\] concatTextFile
> \- \[\] writeShellApplication
> \- \[x\] flutter.buildFlutterApplication #494789
> \- \[\] makePkgconfigItem
> \- \[\] \[syncthing builder\](https://github.com/NixOS/nixpkgs/blob/80bdc1e5ce51f56b19791b52b2901187931f5353/pkgs/applications/networking/syncthing/default.nix#L14-L20)
> \- \[\] fetchtorrent
> \- \[\] mitmCache.fetch
> \- \[\] makeAutostartItem #544951
> \- \[\] \[tree-sitter grammar builder\](https://github.com/NixOS/nixpkgs/blob/c9e6cd244e50f67d2644de7b254fb9208af8724e/pkgs/by-name/tr/tree-sitter/grammars/build-grammar.nix)
> \- \[x\] buildFishPlugin #536604
> \- \[x\] tmuxPlugins.mkTmuxPlugin #554924 
> \- \[\] buildTopkgPackage
> \- \[\] runCommand #551663

---

<div class="post-metadata">

### Author: ![britter](https://discourse.nixos.org/user_avatar/discourse.nixos.org/britter/32/30382_2.png) [@britter](https://discourse.nixos.org/u/britter)
#### Post date: [October 27, 2026, 7:17am UTC](https://discourse.nixos.org/t/improving-maven-build-support-in-nixpkgs-reproducible-thoughts/80702/3 "2026-10-27T07:17:31Z")

</div>

Uh! TIL about `lib.extendMkDerivation`. I’ll check it out and see whether I can apply it to `buildMavenPackage`. Thank you for the pointer!
