-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
49 lines (42 loc) · 1.44 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05";
utils.url = "github:numtide/flake-utils";
sbt.url = "github:zaninime/sbt-derivation";
sbt.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, utils, sbt}:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
in {
# ---------------------------------------------------------------------------
# nix develop
devShells.default = pkgs.mkShell {
buildInputs = [pkgs.sbt pkgs.metals pkgs.jdk22 pkgs.hello];
};
# ---------------------------------------------------------------------------
# nix build
packages.default = sbt.mkSbtDerivation.${system} {
pname = "nix-web-echo";
version = "1.0.0";
depsSha256 = "sha256-nT/IQhgUzyBdsfhuE8THa7gcMEKOv6Xb5Z5j2GpxEmg=";
src = ./.;
buildInputs = [pkgs.sbt pkgs.jdk22_headless pkgs.makeWrapper];
buildPhase = "sbt Universal/packageZipTarball";
installPhase = ''
mkdir -p $out
tar xf target/universal/web-echo.tgz --directory $out
makeWrapper $out/bin/web-echo $out/bin/nix-web-echo \
--set PATH ${pkgs.lib.makeBinPath [
pkgs.gnused
pkgs.gawk
pkgs.coreutils
pkgs.bash
pkgs.jdk22_headless
]}
'';
};
# ---------------------------------------------------------------------------
});
}