Reputation: 13
https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/tools/build-managers/apache-maven Above is the apache maven derivation. When I download maven from nix store it creates a settings.xml file in $out/maven/conf directory which I want to overwrite. The requirement is to add a step to the above derivation that will overwrite the settings.xml file. Can this be done by overlays or by overriding this derivation?
Upvotes: 1
Views: 241
Reputation: 7389
The maven package in its current state doesn't follow the normal stdenv
phases, but its custom builder does call unpackPhase
. This means that you can set variables to influence its behavior.
maven.overrideAttrs (o: { postUnpack = ''
rm $name/conf/settings.xml # just an example; do your thing here
''; })
Technically it's modifying the files before copying to $out, but I don't suppose that will be a problem. If it is, you'd have to split the build.sh
script into the usual stdenv
phases. Then you could use postInstall
.
To use it in an overlay:
final: prev: { # aka self: super:
maven = prev.maven.overrideAttrs (o: /* ... */)
}
Upvotes: 0