Browse Source

Attempt to fix maven build in nix flake

Joeri Exelmans 1 year ago
parent
commit
f765cf46f6
1 changed files with 4 additions and 13 deletions
  1. 4 13
      flake.nix

+ 4 - 13
flake.nix

@@ -18,34 +18,25 @@
           inherit system;
         });
 
-        mavenRepository = pkgs.buildMavenRepositoryFromLockFile {
-          file = ./mvn2nix-lock.json;
-        };
       in rec {
         packages = rec {
-          wee = pkgs.stdenv.mkDerivation rec {
+          wee = pkgs.maven.buildMavenPackage rec {
             pname = "wee";
             version = "0.0.1";
             name = "${pname}-${version}";
             src = pkgs.nix-gitignore.gitignoreSource [ "*.nix" ] ./.;
+            mvnHash = "sha256-KobtWkq/VH3b6W64rEpIxCu3RITTETyYmDcO5l/RLE8=";
             nativeBuildInputs = [
               pkgs.makeWrapper
             ];
-            buildPhase = ''
-              echo "Building with maven repository ${mavenRepository}"
-              ${pkgs.maven}/bin/mvn package --offline -Dmaven.repo.local=${mavenRepository}
-            '';
             installPhase = ''
               # create the bin directory
               mkdir -p $out/bin
 
-              # create a symbolic link for the lib directory
-              ln -s ${mavenRepository} $out/lib
-
               # copy out the JAR
               # Maven already setup the classpath to use m2 repository layout
               # with the prefix of lib/
-              cp target/${name}.jar $out/
+              install -Dm644 target/${name}.jar $out/${name}.jar
 
               # create a wrapper that will automatically set the classpath
               # this should be the paths from the dependency derivation
@@ -56,4 +47,4 @@
         };
         defaultPackage = packages.wee;
       });
-}
+}