2022-07-28 23:54:27 +02:00
|
|
|
{
|
2022-07-29 00:14:21 +02:00
|
|
|
description = "A Nix-flake-based Scala development environment";
|
2022-07-28 23:54:27 +02:00
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs";
|
|
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
|
|
};
|
|
|
|
|
|
|
|
outputs = { self, nixpkgs, flake-utils }:
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
|
|
let
|
|
|
|
jdk = "jdk17";
|
|
|
|
jdkPkg = pkgs.${jdk};
|
|
|
|
|
|
|
|
config = {
|
|
|
|
packageOverrides = p: {
|
2022-07-29 00:11:05 +02:00
|
|
|
sbt = p.sbt.override { jre = p.${jdk}; };
|
|
|
|
scala_3 = p.scala_3.override { jre = p.${jdk}; };
|
2022-07-28 23:54:27 +02:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
pkgs = import nixpkgs { inherit config jdk system; };
|
|
|
|
|
|
|
|
inherit (pkgs) mkShell;
|
|
|
|
|
|
|
|
scala = pkgs.scala_3;
|
|
|
|
|
|
|
|
buildTools = with pkgs; [ sbt ];
|
|
|
|
in {
|
|
|
|
devShells = {
|
2022-07-29 01:21:18 +02:00
|
|
|
default = mkShell {
|
2022-07-29 00:11:05 +02:00
|
|
|
buildInputs = [ scala jdkPkg ] ++ buildTools;
|
2022-07-28 23:54:27 +02:00
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
${scala}/bin/scala -version
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2022-07-29 00:11:05 +02:00
|
|
|
});
|
2022-07-28 23:54:27 +02:00
|
|
|
}
|