Add new store path variable to home assistant

Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
Magic_RB 2023-07-10 00:50:14 +02:00
parent c177ed0be9
commit 58641c2cc4
No known key found for this signature in database
GPG key ID: 08D5287CC5DDCA0E
2 changed files with 20 additions and 1 deletions

View file

@ -1,4 +1,4 @@
{ elib, vars, ... }: { elib, vars, config', ... }:
let let
inherit (elib) inherit (elib)
nfsVolume nfsVolume
@ -74,6 +74,12 @@ in
vars = { vars = {
flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}"; flake_ref = "${vars.flake_host}?rev=${vars.flake_rev}&ref=${vars.flake_ref}";
flake_sha = vars.flake_sha; flake_sha = vars.flake_sha;
store_path = builtins.toJSON (builtins.mapAttrs (_: builtins.unsafeDiscardStringContext) {
mosquitto = config'.flake.nixngConfigurations.mosquitto.config.system.build.toplevel;
postgresql = config'.flake.nixngConfigurations.homeAssistantPostgresql.config.system.build.toplevel;
homeAssistant = config'.flake.nixngConfigurations.homeAssistant.config.system.build.toplevel;
zigbee2mqtt = config'.flake.nixngConfigurations.zigbee2mqtt.config.system.build.toplevel;
});
}; };
}; };
} }

View file

@ -6,6 +6,15 @@ variable "flake_sha" {
type = string type = string
} }
variable "store_path" {
type = object({
mosquitto = string
postgresql = string
homeAssistant = string
zigbee2mqtt = string
})
}
job "home-assistant" { job "home-assistant" {
datacenters = [ "homelab-1" ] datacenters = [ "homelab-1" ]
type = "service" type = "service"
@ -68,6 +77,7 @@ job "home-assistant" {
config { config {
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.zigbee2mqtt.config.system.build.toplevel" nix_flake_ref = "${var.flake_ref}#nixngConfigurations.zigbee2mqtt.config.system.build.toplevel"
nix_flake_sha = var.flake_sha nix_flake_sha = var.flake_sha
nix_flake_store_path = var.store_path.zigbee2mqtt
entrypoint = [ "init" ] entrypoint = [ "init" ]
devices = [ devices = [
@ -147,6 +157,7 @@ EOF
config { config {
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.mosquitto.config.system.build.toplevel" nix_flake_ref = "${var.flake_ref}#nixngConfigurations.mosquitto.config.system.build.toplevel"
nix_flake_sha = var.flake_sha nix_flake_sha = var.flake_sha
nix_flake_store_path = var.store_path.mosquitto
entrypoint = [ "init" ] entrypoint = [ "init" ]
} }
@ -244,6 +255,7 @@ EOF
config { config {
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.homeAssistantPostgresql.config.system.build.toplevel" nix_flake_ref = "${var.flake_ref}#nixngConfigurations.homeAssistantPostgresql.config.system.build.toplevel"
nix_flake_sha = var.flake_sha nix_flake_sha = var.flake_sha
nix_flake_store_path = var.store_path.postgresql
entrypoint = [ "init" ] entrypoint = [ "init" ]
} }
@ -275,6 +287,7 @@ EOF
config { config {
nix_flake_ref = "${var.flake_ref}#nixngConfigurations.homeAssistant.config.system.build.toplevel" nix_flake_ref = "${var.flake_ref}#nixngConfigurations.homeAssistant.config.system.build.toplevel"
nix_flake_sha = var.flake_sha nix_flake_sha = var.flake_sha
nix_flake_store_path = var.store_path.homeAssistant
entrypoint = [ "init" ] entrypoint = [ "init" ]
} }