forked from thesamet/sbt-protoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
91 lines (89 loc) · 2.57 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
{
description = "A flake for getting started with Scala.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, flake-utils
,
}:
let
supportedSystems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
"x86_64-darwin"
];
in
flake-utils.lib.eachSystem supportedSystems (
system:
let
buildOverlays =
{ nixpkgs, system, ... }:
let
pkgs = import nixpkgs { inherit system; };
makeOverlays =
let
armOverlay =
_: prev:
let
pkgsForx86 = import nixpkgs { localSystem = "x86_64-darwin"; };
in
prev.lib.optionalAttrs (prev.stdenv.isDarwin && prev.stdenv.isAarch64) {
inherit (pkgsForx86) bloop;
};
ammoniteOverlay = final: prev: { ammonite = prev.ammonite.override { jre = pkgs.graalvm-ce; }; };
bloopOverlay = final: prev: { bloop = prev.bloop.override { jre = final.graalvm-ce; }; };
scalaCliOverlay = final: prev: { scala-cli = prev.scala-cli.override { jre = final.graalvm-ce; }; };
javaOverlay = final: _: {
jdk = pkgs.graalvm-ce;
jre = pkgs.graalvm-ce;
};
in
[
javaOverlay
armOverlay
bloopOverlay
scalaCliOverlay
ammoniteOverlay
];
makePackages =
let
overlays = makeOverlays;
in
import nixpkgs { inherit system overlays; };
default = makePackages;
in
{
inherit default;
};
pkgs = buildOverlays { inherit nixpkgs system; };
java = pkgs.default.graalvm-ce;
in
{
devShells.default = pkgs.default.mkShell {
buildInputs = with pkgs.default; [
ammonite
bloop
coursier
graalvm-ce
sbt
scala-cli
scalafmt
];
shellHook = ''
#SHOVE THIS JDK SOMEWHERE TO MAKE IDEA HAPPY
mkdir -p ./.share
if [ -L "./.share/java" ]; then
unlink "./.share/java"
fi
ln -sf ${java} ./.share/java
'';
};
formatter = pkgs.default.nixpkgs-fmt;
}
);
}