You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.1 KiB
50 lines
1.1 KiB
{ pkgs
|
|
, stdenv
|
|
, fetchFromGitHub
|
|
, jdk17_headless
|
|
, maven
|
|
, nix-gitignore
|
|
, makeWrapper
|
|
, ...
|
|
}:
|
|
|
|
let
|
|
mvn2nix = fetchFromGitHub {
|
|
owner = "fzakaria";
|
|
repo = "mvn2nix";
|
|
rev = "ea21cfe97069feee55fa307ca9b125616c1fa84f";
|
|
hash = "sha256-v/HvYqzkPaGin1ujo+Fi59wXC9vWxW3lYVSwElORRi8=";
|
|
};
|
|
|
|
repository = (pkgs.callPackage "${mvn2nix}/maven.nix" {}).buildMavenRepositoryFromLockFile {
|
|
file = ./mvn2nix-lock.json;
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
|
name = "ldap-sync";
|
|
|
|
src = nix-gitignore.gitignoreSource [] ./.;
|
|
|
|
nativeBuildInputs = [ jdk17_headless maven makeWrapper ];
|
|
|
|
buildPhase = ''
|
|
mvn --offline -Dmaven.repo.local=${repository} package -DskipTests;
|
|
'';
|
|
|
|
testPhase = ''
|
|
mvn --offline -Dmaven.repo.local=${repository} verify;
|
|
'';
|
|
|
|
installPhase = ''
|
|
install -Dm644 target/${name}-1.0-SNAPSHOT-jar-with-dependencies.jar $out/share/java/${name}.jar
|
|
|
|
makeWrapper ${jdk17_headless}/bin/java $out/bin/${name} \
|
|
--add-flags "-jar $out/share/java/${name}.jar"
|
|
'';
|
|
|
|
passthru = {
|
|
inherit repository;
|
|
mvn2nix = pkgs.callPackage "${mvn2nix}/default.nix" { };
|
|
};
|
|
}
|
|
|