summaryrefslogtreecommitdiff
path: root/pkgs/fetch-ant-deps.nix
diff options
context:
space:
mode:
authorseth <[email protected]>2024-08-26 23:51:17 -0400
committerSeth Flynn <[email protected]>2025-03-05 04:36:03 -0500
commitb229a37e59b9720b7017e72a6d159b869ff36458 (patch)
tree829090d2236ac707d5670c496781a4a888a0b700 /pkgs/fetch-ant-deps.nix
[skip ci] initial commit
Diffstat (limited to 'pkgs/fetch-ant-deps.nix')
-rw-r--r--pkgs/fetch-ant-deps.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/pkgs/fetch-ant-deps.nix b/pkgs/fetch-ant-deps.nix
new file mode 100644
index 0000000..69e29b4
--- /dev/null
+++ b/pkgs/fetch-ant-deps.nix
@@ -0,0 +1,68 @@
+{
+ lib,
+ stdenv,
+ ant,
+ buildPackages,
+}:
+
+lib.makeOverridable (
+ lib.fetchers.withNormalizedHash { } (
+ {
+ pname,
+ nativeBuildInputs ? [ ],
+ antJdk ? buildPackages.jdk,
+ outputHash,
+ outputHashAlgo,
+ ...
+ }@args:
+
+ let
+ args' = lib.removeAttrs args [
+ "pname"
+ "nativeBuildInputs"
+ "antJdk"
+ ];
+ in
+
+ stdenv.mkDerivation (
+ lib.recursiveUpdate {
+ pname = pname + "-ant-deps";
+
+ nativeBuildInputs = [ ant ] ++ nativeBuildInputs;
+
+ buildPhase = ''
+ runHook preBuild
+ ant init
+ runHook postBuild
+ '';
+
+ installPhase = ''
+ runHook preInstall
+ mv bin/libs $out
+ runHook postInstall
+ '';
+
+ fixupPhase = ''
+ runHook preFixup
+
+ find $out -type f \( \
+ -name \*.lastUpdated \
+ -o -name resolver-status.properties \
+ -o -name _remote.repositories \) \
+ -delete
+
+ runHook postFixup
+ '';
+
+ dontConfigure = true;
+
+ env = {
+ JAVA_HOME = toString (antJdk.passthru.home or antJdk);
+ };
+
+ inherit outputHash outputHashAlgo;
+ outputHashMode = "recursive";
+ } args'
+ )
+ )
+)