mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-12-04 22:14:58 +01:00
4a29b6d8d3
Signed-off-by: magic_rb <magic_rb@redalder.org>
124 lines
3.2 KiB
Nix
124 lines
3.2 KiB
Nix
{
|
|
elib,
|
|
tflib,
|
|
vars,
|
|
config',
|
|
...
|
|
}: let
|
|
inherit
|
|
(elib)
|
|
nfsVolume
|
|
nomadJob
|
|
;
|
|
inherit
|
|
(tflib)
|
|
tf
|
|
;
|
|
buildNixNGSystem' = attrs:
|
|
elib.buildNixNGSystem (attrs
|
|
// {
|
|
hosts = [
|
|
"blowhole.hosts.in.redalder.org"
|
|
];
|
|
});
|
|
in {
|
|
resource."nomad_volume"."home-assistant_hass" = nfsVolume {
|
|
volume_name = "home-assistant_hass";
|
|
access_mode = "single-node-writer";
|
|
server = "blowhole.hosts.in.redalder.org";
|
|
share = "/mnt/kyle/infrastructure/home-assistant/home-assistant";
|
|
mount_flags = ["nfsvers=3" "hard" "async"];
|
|
};
|
|
|
|
resource."nomad_volume"."home-assistant_db" = nfsVolume {
|
|
volume_name = "home-assistant_db";
|
|
access_mode = "single-node-writer";
|
|
server = "blowhole.hosts.in.redalder.org";
|
|
share = "/mnt/jimmy/infrastructure/home-assistant/postgresql";
|
|
mount_flags = ["nfsvers=3" "hard" "async"];
|
|
};
|
|
|
|
resource."nomad_volume"."home-assistant_zigbee2mqtt" = nfsVolume {
|
|
volume_name = "home-assistant_zigbee2mqtt";
|
|
access_mode = "single-node-writer";
|
|
server = "blowhole.hosts.in.redalder.org";
|
|
share = "/mnt/kyle/infrastructure/home-assistant/zigbee2mqtt";
|
|
mount_flags = ["nfsvers=3" "hard" "async"];
|
|
};
|
|
|
|
resource."nomad_volume"."home-assistant_mosquitto" = nfsVolume {
|
|
volume_name = "home-assistant_mosquitto";
|
|
access_mode = "single-node-writer";
|
|
server = "blowhole.hosts.in.redalder.org";
|
|
share = "/mnt/kyle/infrastructure/home-assistant/mosquitto";
|
|
mount_flags = ["nfsvers=3" "hard" "async"];
|
|
};
|
|
|
|
resource."vault_policy"."home-assistant-policy" = {
|
|
name = "home-assistant-policy";
|
|
policy = ''
|
|
path "kv/data/cluster/home-assistant" {
|
|
capabilities = ["read"]
|
|
}
|
|
'';
|
|
};
|
|
|
|
resource."vault_policy"."zigbee2mqtt-policy" = {
|
|
name = "zigbee2mqtt-policy";
|
|
policy = ''
|
|
path "kv/data/cluster/mqtt" {
|
|
capabilities = ["read"]
|
|
}
|
|
|
|
path "kv/data/cluster/zigbee2mqtt" {
|
|
capabilities = ["read"]
|
|
}
|
|
'';
|
|
};
|
|
|
|
resource."vault_policy"."mosquitto-policy" = {
|
|
name = "mosquitto-policy";
|
|
policy = ''
|
|
path "kv/data/cluster/mqtt" {
|
|
capabilities = ["read"]
|
|
}
|
|
'';
|
|
};
|
|
|
|
imports = [
|
|
(buildNixNGSystem' {
|
|
name = "mosquitto";
|
|
})
|
|
(buildNixNGSystem' {
|
|
name = "homeAssistantPostgresql";
|
|
})
|
|
(buildNixNGSystem' {
|
|
name = "homeAssistant";
|
|
})
|
|
(buildNixNGSystem' {
|
|
name = "zigbee2mqtt";
|
|
})
|
|
];
|
|
|
|
resource."nomad_job"."home-assistant" = nomadJob {
|
|
jobspec = ./job.hcl;
|
|
|
|
vars = {
|
|
flake_ref = "unused";
|
|
flake_sha = "unused";
|
|
store_path = builtins.toJSON {
|
|
mosquitto = tf "data.external.nixng-system-mosquitto.result.out";
|
|
postgresql = tf "data.external.nixng-system-homeAssistantPostgresql.result.out";
|
|
homeAssistant = tf "data.external.nixng-system-homeAssistant.result.out";
|
|
zigbee2mqtt = tf "data.external.nixng-system-zigbee2mqtt.result.out";
|
|
};
|
|
};
|
|
|
|
depends_on = [
|
|
"terraform_data.nixng-system-mosquitto-copy"
|
|
"terraform_data.nixng-system-homeAssistantPostgresql-copy"
|
|
"terraform_data.nixng-system-homeAssistant-copy"
|
|
"terraform_data.nixng-system-zigbee2mqtt-copy"
|
|
];
|
|
};
|
|
}
|