-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.nix
executable file
·36 lines (35 loc) · 946 Bytes
/
deploy.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
{ self, ... }:
{
flake = {
deployment =
let
cfgs = builtins.listToAttrs (
map (host: {
name = host;
value = self.nixosConfigurations.${host}.config;
}) (builtins.attrNames self.nixosConfigurations)
);
hosts = builtins.filter (host: cfgs.${host}.arcanum.deploy) (builtins.attrNames cfgs);
in
builtins.listToAttrs (
map (name: {
inherit name;
value =
let
cfg = cfgs.${name};
in
{
hostname = name;
inherit (cfg.arcanum) username;
target = "${name}.${cfg.modules.networking.wireguard.interface}.${cfg.arcanum.domain}";
port = 22420;
retry = {
max_attempts = 5;
initial_delay = 5;
max_delay = 30;
};
};
}) hosts
);
};
}