dev-templates/java/flake.nix
2022-08-20 15:54:34 +03:00

43 lines
857 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
javaVersion = 17;
overlays = [
(self: super: rec {
jdk = super."jdk${toString javaVersion}";
gradle = super.gradle.override {
java = jdk;
};
maven = super.maven.override {
inherit jdk;
};
})
];
pkgs = import nixpkgs { inherit overlays system; };
in
{
devShell = pkgs.mkShell {
buildInputs = with pkgs; [ gradle jdk maven ];
shellHook = ''
${pkgs.jdk}/bin/java -version
'';
};
});
}