{
  inputs = rec {
    nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
    flake-utils.url = "github:numtide/flake-utils";
    mvn2nix.url = "github:fzakaria/mvn2nix";
    mvn2nix.inputs = { inherit nixpkgs; utils = flake-utils; };
  };

  outputs = { nixpkgs, mvn2nix, flake-utils, ... }:
    flake-utils.lib.eachDefaultSystem (system:
      let
        pkgs = (import nixpkgs {
          overlays = [ mvn2nix.overlay ];
          inherit system;
        });

        mavenRepository = pkgs.buildMavenRepositoryFromLockFile {
          file = ./mvn2nix-lock.json;
        };
      in rec {
        packages = rec {
          wee = pkgs.stdenv.mkDerivation rec {
            pname = "wee";
            version = "0.0.1";
            name = "${pname}-${version}";
            src = pkgs.nix-gitignore.gitignoreSource [ "*.nix" ] ./.;
            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/

              # 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;
      });
}