-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
81 lines (81 loc) · 2.76 KB
/
flake.nix
File metadata and controls
81 lines (81 loc) · 2.76 KB
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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
purescript-overlay = {
url = "github:thomashoneyman/purescript-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
spago-nix.url = "github:purestack-dev/spago-nix";
project-m36-rest = {
url = "github:purestack-dev/project-m36-rest";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, purescript-overlay, spago-nix
, project-m36-rest }:
let supportedSystems = flake-utils.lib.defaultSystems;
in flake-utils.lib.eachSystem supportedSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ purescript-overlay.overlays.default ];
};
pc-config = pkgs.writeText "process-compose.yaml" (builtins.toJSON {
version = "0.5";
processes = {
spago-frontend = {
command =
"${pkgs.spago}/bin/spago bundle-app --watch --main Frontend --source-maps --to frontend.js";
is_tty = true;
};
spago-backend = {
command =
"${pkgs.spago}/bin/spago bundle-app --watch --main Backend --source-maps --to backend.js";
is_tty = true;
};
bun.command = "${pkgs.bun}/bin/bun run --watch backend.js";
project-m36.command = "${
project-m36-rest.packages.${system}.default
}/bin/project-m36-rest";
proxy.command =
"${pkgs.reproxy}/bin/reproxy -l=localhost:3001 --static.enabled --static.rule='*,^/api/(.*),http://localhost:3000/$$1' --assets.location=. --assets.spa --logger.stdout";
};
});
in {
packages = {
frontend = spago-nix.lib.spago { inherit pkgs; } {
src = ./.;
main = "Frontend";
};
backend = spago-nix.lib.spago { inherit pkgs; } {
src = ./.;
main = "Backend";
};
};
apps = {
dev = {
type = "app";
program = (pkgs.writeScript "process-compose" ''
#!/bin/sh
${pkgs.process-compose}/bin/process-compose --config ${pc-config} "$@"
'').outPath;
};
};
devShells = {
default = pkgs.mkShell {
buildInputs = with pkgs; [
purescript
spago
nodePackages_latest.purs-tidy
nodePackages_latest.purescript-language-server
];
};
};
});
nixConfig = {
extra-substituters = [ "https://cache.garnix.io" ];
extra-trusted-public-keys =
[ "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" ];
};
}