nixos-config/terranix/servers/config.nix

36 lines
765 B
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config , ... }:
let
get = element: object:
"\${ ${object."_ref"}.${element} }";
getVariable = name:
"\${ var.${name} }";
in {
hcloud = {
enable = true;
resource.server."tinc_node" = {
name = "tinc-node-nurnberg";
image = "ubuntu-18.04";
server_type = "cx11";
backups = false;
# datacenter = "nbg1-dc3";
location = "nbg1";
labels = {
system = "nixos";
};
};
};
output = {
"${config.hcloud.resource.server."tinc_node".name}-ip4_address".value =
get "ipv4_address" config.hcloud.resource.server."tinc_node";
"${config.hcloud.resource.server."tinc_node".name}-ip6_address".value =
get "ipv6_address" config.hcloud.resource.server."tinc_node";
};
}