/
profile.nix
50 lines (49 loc) · 1.59 KB
/
profile.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
{ pkgs, lib }:
with lib;
{ profileNix
, backendProfile ## Backend-specific results for forwarding
, workbench
}:
pkgs.runCommand "workbench-profile-output-${profileNix.name}"
{ buildInputs = with pkgs; [ jq workbench ];
nodeServices =
__toJSON
(flip mapAttrs profileNix.node-services
(name: svc:
with svc;
{ inherit name;
service-config = serviceConfig.JSON;
start = startupScript;
config = nodeConfig.JSON;
topology = topology.JSON;
}));
generatorService =
with profileNix.generator-service;
__toJSON
{ name = "generator";
service-config = serviceConfig.JSON;
start = startupScript;
run-script = runScript.JSON;
};
tracerService =
with profileNix.tracer-service;
__toJSON
{ name = "tracer";
tracer-config = tracer-config.JSON;
nixos-service-config = nixos-service-config.JSON;
config = config.JSON;
start = startupScript;
};
passAsFile = [ "nodeServices" "generatorService" "tracerService" ];
}
''
mkdir $out
cp ${profileNix.JSON} $out/profile.json
cp ${profileNix.node-specs.JSON} $out/node-specs.json
cp ${backendProfile}/* $out
cp $nodeServicesPath $out/node-services.json
cp $generatorServicePath $out/generator-service.json
cp $tracerServicePath $out/tracer-service.json
''
// { inherit (profileNix) name;
}