123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- {
- 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-PUUlNgRvBiZZVH3zxTmQW92nBo90nm+FSS1Ryw/0rB0=";
- 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;
- });
- }
|