dev-templates/java/flake.nix
Luc Perkins bf45826289
fmt
2022-08-20 14:47:43 +03:00

37 lines
853 B
Nix

{
description = "A Nix-flake-based Java development environment";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs";
};
outputs = { self, flake-utils, nixpkgs }:
flake-utils.lib.eachDefaultSystem (system:
let
jdk = pkgs.jdk17;
config = {
packageOverrides = p: {
gradle = (p.gradle.override { java = jdk; });
};
};
pkgs = import nixpkgs { inherit config jdk system; };
java = jdk;
buildTools = with pkgs; [ ant gradle maven ];
inherit (pkgs) mkShell;
in
{
devShells = {
default = mkShell {
buildInputs = [ java ] ++ buildTools;
shellHook = ''
${java}/bin/java -version
'';
};
};
});
}