Skip to content

Commit 4104e6a

Browse files
committed
nix: Add the maven repository as additional output
This is useful to allow reuse of DiffDetective for further builds using nix.
1 parent f6a2956 commit 4104e6a

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

default.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ pkgs.stdenvNoCC.mkDerivation rec {
6666
outputHash = "sha256-LJQfV426han/+H9ejUla7JvN1LS/c9l3e7hODs4Z7Kg=";
6767
};
6868

69+
outputs = ["out" "maven"];
70+
6971
jre-minimal = pkgs.callPackage (import "${sources.nixpkgs}/pkgs/development/compilers/openjdk/jre.nix") {
7072
modules = ["java.base" "java.desktop"];
7173
};
@@ -120,6 +122,16 @@ pkgs.stdenvNoCC.mkDerivation rec {
120122
else ""
121123
}
122124
125+
cp -r "$mavenRepo" "$maven"
126+
chmod u+w -R "$maven"
127+
mvn --offline -Dmaven.repo.local="$maven" -Dmaven.test.skip=true install
128+
129+
# keep only *.{pom,jar,sha1,nbm} and delete all ephemeral files with lastModified timestamps inside
130+
find "$maven" -type f \
131+
\( -not \( -name "*.pom" -o -name "*.jar" -o -name "*.sha1" -o -name "*.nbm" \) \
132+
-o -name "maven-metadata*" \) \
133+
-delete
134+
123135
runHook postInstall
124136
'';
125137

0 commit comments

Comments
 (0)