-
Notifications
You must be signed in to change notification settings - Fork 72
/
flake.nix
105 lines (90 loc) · 2.72 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{
description = "Scala development shell";
inputs = {
nixpkgs.url = github:nixos/nixpkgs/nixpkgs-unstable;
flake-utils.url = github:numtide/flake-utils;
};
outputs = { self, nixpkgs, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
dockerOverlay = f: p: with f.dockerTools; {
# September 2022: this docker image stopped working with sbt-native-packager
noRootDockerImage = buildLayeredImage {
name = "jdk17-curl";
tag = "latest";
contents = [ f.curl f.jre ];
};
slimDockerImage = buildImage {
name = "jdk17-curl";
fromImage = pullImage {
imageName = "openjdk";
imageDigest = "sha256:2e7658fb62d1c6f319ff9870614deaf8e06038dd41eec3d1ecdcfabd186234fd";
sha256 = "0m47vk8k97xqgc6bnxhmyyyvqnrn5jdqx8rw417740963h4i813v";
finalImageName = "openjdk";
finalImageTag = "17-jdk-slim-buster";
os = "linux";
arch = "amd64";
};
tag = "latest";
copyToRoot = [ p.curl ];
};
};
jreOverlay = f: p: {
jre = p.jdk17_headless;
};
pkgs = import nixpkgs {
inherit system;
overlays = [ dockerOverlay jreOverlay ];
};
elm-webapp = pkgs.callPackage ./web-app/app.nix { };
tyrian = pkgs.callPackage ./modules/ws-client/app.nix { };
in
{
devShells = rec {
default = scala;
elm = pkgs.mkShell {
name = "elm-dev-shell";
buildInputs = with pkgs.elmPackages; [
pkgs.elmPackages.elm
elm-format
elm-language-server
elm-review
elm-test
];
};
scala = pkgs.mkShell {
name = "scala-dev-shell";
buildInputs = with pkgs; [
coursier
envsubst
jre
kubectl
minikube
sbt
];
shellHook = ''
JAVA_HOME="${pkgs.jre}"
'';
};
tyrian = pkgs.mkShell {
name = "tyrian-dev-shell";
buildInputs = with pkgs; [
yarn
yarn2nix
];
};
};
apps.tyrian-webapp = {
type = "app";
program = "${tyrian.webserver}/bin/trading-webserver";
};
packages = {
inherit elm-webapp;
tyrian-webapp = tyrian.webapp;
docker = pkgs.noRootDockerImage;
slimDocker = pkgs.slimDockerImage;
};
defaultPackage = pkgs.slimDockerImage;
}
);
}