{ inputs = rec { nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable; flake-utils.url = "github:numtide/flake-utils"; mvn2nix = { url = "github:fzakaria/mvn2nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.utils.follows = "flake-utils"; }; }; outputs = { nixpkgs, mvn2nix, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = (import nixpkgs { overlays = [ mvn2nix.overlay ]; inherit system; }); in rec { packages = 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 ]; installPhase = '' # create the bin directory mkdir -p $out/bin # copy out the JAR # Maven already setup the classpath to use m2 repository layout # with the prefix of lib/ 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 makeWrapper ${pkgs.jdk11_headless}/bin/java $out/bin/${pname} \ --add-flags "-jar $out/${name}.jar" ''; }; }; defaultPackage = packages.wee; }); }