Skip to content

Commit 6c489a1

Browse files
Add nix flake dev environment
1 parent da66d99 commit 6c489a1

File tree

3 files changed

+86
-0
lines changed

3 files changed

+86
-0
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use flake

flake.lock

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
description = "A Nix-flake-based Scala development environment";
3+
4+
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1"; # unstable Nixpkgs
5+
6+
outputs =
7+
{ self, ... }@inputs:
8+
9+
let
10+
javaVersion = 23; # Change this value to update the whole stack
11+
12+
supportedSystems = [
13+
"x86_64-linux"
14+
"aarch64-linux"
15+
"x86_64-darwin"
16+
"aarch64-darwin"
17+
];
18+
forEachSupportedSystem =
19+
f:
20+
inputs.nixpkgs.lib.genAttrs supportedSystems (
21+
system:
22+
f {
23+
pkgs = import inputs.nixpkgs {
24+
inherit system;
25+
overlays = [ inputs.self.overlays.default ];
26+
};
27+
}
28+
);
29+
in
30+
{
31+
overlays.default =
32+
final: prev:
33+
let
34+
jdk = prev."jdk${toString javaVersion}";
35+
in
36+
{
37+
sbt = prev.sbt.override { jre = jdk; };
38+
scala = prev.scala_3.override { jre = jdk; };
39+
mill = prev.mill.override { jre = jdk; };
40+
};
41+
42+
devShells = forEachSupportedSystem (
43+
{ pkgs }:
44+
{
45+
default = pkgs.mkShellNoCC {
46+
packages = with pkgs; [
47+
scala
48+
sbt
49+
mill
50+
coursier
51+
verilator
52+
gcc
53+
gnumake
54+
python3
55+
];
56+
};
57+
}
58+
);
59+
};
60+
}

0 commit comments

Comments
 (0)