/
supervisor.nix
71 lines (65 loc) · 1.73 KB
/
supervisor.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
let
basePort = 30000;
cacheDirDefault = "${__getEnv "HOME"}/.cache/cardano-workbench";
stateDir = "run/current";
in
{ pkgs
, lib
, workbench
##
, cacheDir ? cacheDirDefault
, extraSupervisorConfig ? {}
, useCabalRun ? false
, enableEKG ? true
##
, ...
}:
with lib;
let
backend =
rec
{ name = "supervisor";
services-config = import ./profiles/services-config.nix {inherit lib workbench basePort stateDir useCabalRun enableEKG;};
materialise-profile =
{ profileNix }:
pkgs.runCommand "workbench-profile-outputs-${profileNix.name}-supervisord" {}
''
mkdir $out
cp ${supervisord.mkSupervisorConf profileNix} $out/supervisor.conf
'';
## IMPORTANT: keep in sync with envArgs in 'workbench/default.nix/generateProfiles/environment'.
env-args-base =
{
inherit (pkgs) cardanoLib;
inherit stateDir cacheDir basePort;
staggerPorts = true;
};
## Backend-specific Nix bits:
supervisord =
{
inherit
extraSupervisorConfig;
## mkSupervisorConf :: Profile -> SupervisorConf
mkSupervisorConf =
profile:
pkgs.callPackage ./supervisor-conf.nix
{ inherit (profile) node-services generator-service;
inherit
pkgs lib stateDir
basePort
extraSupervisorConfig;
};
};
};
all-profiles =
workbench.all-profiles
{ inherit backend;
envArgs = backend.env-args-base;
};
in
{
inherit cacheDir stateDir basePort;
inherit workbench;
inherit backend;
inherit all-profiles;
}