-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
67 lines (58 loc) · 1.96 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
utils.url = "github:numtide/flake-utils";
sbtDerivation.url = "github:zaninime/sbt-derivation";
sbtDerivation.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, utils, sbtDerivation }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
fs = pkgs.lib.fileset;
mkSbtDerivation = sbtDerivation.mkSbtDerivation.${system};
sbt = pkgs.sbt;
compiledScalaFrontend = pkgs.callPackage nix/compiled-frontend.nix {
inherit mkSbtDerivation fs sbt;
};
bundledScalaFrontend = pkgs.callPackage nix/bundled-frontend.nix {
inherit fs pkgs compiledScalaFrontend;
};
styles = pkgs.callPackage nix/styles.nix { inherit fs pkgs; };
assetsWithoutServiceWorker = pkgs.symlinkJoin {
name = "assets";
paths = [ bundledScalaFrontend styles ./frontend/src/main/static ];
};
serviceWorker = pkgs.callPackage nix/service-worker.nix {
inherit mkSbtDerivation fs sbt;
assets = assetsWithoutServiceWorker;
};
assets = pkgs.symlinkJoin {
name = "assets";
paths = [ assetsWithoutServiceWorker serviceWorker ];
};
dockerImage = pkgs.dockerTools.buildLayeredImage {
name = "gregor23/sudoku";
tag = self.rev or "dirty";
config.Cmd = [
"${pkgs.static-web-server}/bin/static-web-server"
"-p"
"8080"
"-d"
assets
];
};
in {
devShells.default = pkgs.mkShell {
packages = [ pkgs.sbt pkgs.static-web-server ];
shellHook = ''
echo shellhook
'';
};
packages = {
default = assets;
inherit assets assetsWithoutServiceWorker dockerImage;
};
formatter = pkgs.nixfmt;
});
}