-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
104 lines (90 loc) · 2.56 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
{
description = "fit4s flake";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
sbt.url = "github:zaninime/sbt-derivation";
sbt.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, sbt }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in
rec
{
overlays.default = final: prev: {
fit4s = with final; sbt.lib.mkSbtDerivation {
pkgs = final;
version = "dynamic";
pname = "fit4s-cli";
nativeBuildInputs = [ pkgs.nodejs ];
# depsWarmupCommand = ''
# sbt compile webviewJS/tzdbCodeGen
# '';
src = lib.sourceByRegex ./. [
"^build.sbt$"
"^modules$"
"^modules/.*$"
"^project$"
"^project/.*$"
"^make-cli.sh$"
];
depsSha256 = "sha256-+Yj69e4d3o2Nf2kGvK6hmD7fpYyZAqAmoKxC3/10Kmk=";
buildPhase = ''
env
ls -lha
bash make-cli.sh
'';
installPhase = ''
mkdir -p $out
cp -R modules/cli/target/universal/stage/* $out/
cat > $out/bin/fit4s <<-EOF
#!${bash}/bin/bash
$out/bin/fit4s-cli -java-home ${jdk} "\$@"
EOF
chmod 755 $out/bin/fit4s
'';
};
};
apps = forAllSystems (system:
{ default = {
type = "app";
program = "${self.packages.${system}.default}/bin/fit4s";
};
});
packages = forAllSystems (system:
{
default = (import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
}).fit4s;
});
devShells = forAllSystems(system:
{ default =
let
overlays = import ./nix/overlays.nix;
pkgs = import nixpkgs {
inherit system;
overlays = [
overlays.sbt
overlays.postgres-fg
];
};
in
pkgs.mkShell {
buildInputs = [
pkgs.sbt
pkgs.openjdk
pkgs.nodejs
pkgs.postgres-fg
pkgs.scala-cli
];
nativeBuildInputs =
[
];
SBT_OPTS = "-Xmx2G";
JAVA_HOME = "${pkgs.openjdk19}/lib/openjdk";
};
});
};
}