-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.nix
61 lines (51 loc) · 1.4 KB
/
app.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
{ lib, k8s, options, config, pkgs, ...}:
with lib;
let
convox-options = pkgs.callPackage ./options.nix {};
kaniko-builder = pkgs.callPackage ./kaniko-builder.nix {
inherit k8s lib pkgs;
};
in {
kubernetes.moduleDefinitions.convox.module = { name, config, module, ... }: {
imports = [];
options = convox-options.manifest.options;
config = let
appName = name;
services = mapAttrs (
name: attrs: {
module = "convox-service";
configuration = attrs // {
labels = {
app = appName;
};
environmentSecret = appName;
environment = config.environment ++ attrs.environment ++ [
"VERSION=${config.version}"
];
};
}
) config.services;
timers = mapAttrs (
name: attrs: {
module = "convox-timer";
configuration = attrs // {
labels = {
app = appName;
};
serviceOpts = config.services.${attrs.service} // {
environmentSecret = appName;
environment = config.environment ++ [
"VERSION=${config.version}"
];
};
};
}
) config.timers;
in (mkMerge [
# (kaniko-builder { namespace = module.namespace; })
{
kubernetes.modules = services // timers;
}
]);
};
}