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

1 year ago
10 months ago
1 year ago
10 months ago
1 year ago
  1. { pkgs
  2. , stdenv
  3. , fetchFromGitHub
  4. , jdk17_headless
  5. , maven
  6. , nix-gitignore
  7. , makeWrapper
  8. , ...
  9. }:
  10. let
  11. mvn2nix = fetchFromGitHub {
  12. owner = "fzakaria";
  13. repo = "mvn2nix";
  14. rev = "ea21cfe97069feee55fa307ca9b125616c1fa84f";
  15. hash = "sha256-v/HvYqzkPaGin1ujo+Fi59wXC9vWxW3lYVSwElORRi8=";
  16. };
  17. repository = (pkgs.callPackage "${mvn2nix}/maven.nix" {}).buildMavenRepositoryFromLockFile {
  18. file = ./mvn2nix-lock.json;
  19. };
  20. in stdenv.mkDerivation rec {
  21. name = "ldap-sync";
  22. src = nix-gitignore.gitignoreSource [] ./.;
  23. nativeBuildInputs = [ jdk17_headless maven makeWrapper ];
  24. buildPhase = ''
  25. mvn --offline -Dmaven.repo.local=${repository} package -DskipTests;
  26. '';
  27. testPhase = ''
  28. mvn --offline -Dmaven.repo.local=${repository} verify;
  29. '';
  30. installPhase = ''
  31. install -Dm644 target/${name}-1.0-SNAPSHOT-jar-with-dependencies.jar $out/share/java/${name}.jar
  32. makeWrapper ${jdk17_headless}/bin/java $out/bin/${name} \
  33. --add-flags "-jar $out/share/java/${name}.jar"
  34. '';
  35. passthru = {
  36. inherit repository;
  37. mvn2nix = pkgs.callPackage "${mvn2nix}/default.nix" { };
  38. };
  39. }