2020-01-06 06:37:25 +01:00
|
|
|
# --------------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# collect all server information and generate files which get picked up
|
|
|
|
# by 02-build to deploy the machines properly.
|
|
|
|
#
|
|
|
|
# This makes it possible to deploy VPNs like tinc and wireguard.
|
|
|
|
#
|
|
|
|
# --------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
{ config, lib, pkgs, ... }: {
|
|
|
|
resource.local_file = {
|
|
|
|
nixosMachines = {
|
|
|
|
content = with lib;
|
|
|
|
let
|
|
|
|
serverPart = name: ''
|
|
|
|
${name} = {
|
|
|
|
host = "''${ hcloud_server.${name}.ipv4_address }";
|
|
|
|
user = "root";
|
|
|
|
};
|
|
|
|
'';
|
|
|
|
allServerParts = map serverPart (attrNames config.hcloud.server);
|
2021-11-01 19:30:41 +01:00
|
|
|
in
|
|
|
|
''
|
2020-01-06 06:37:25 +01:00
|
|
|
{
|
|
|
|
${concatStringsSep "\n" allServerParts}
|
|
|
|
}
|
|
|
|
'';
|
|
|
|
filename = "${toString ../../02-build/generated/nixos-machines.nix}";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|