From 7449ab4dee15568a67e3dc95f2d18eb04ecb9611 Mon Sep 17 00:00:00 2001 From: Malte Tammena Date: Sun, 17 Nov 2024 15:15:11 +0100 Subject: [PATCH] feat(host/faunus-ater): experiment with nixifying the home assistant config --- hosts/faunus-ater/modules/home-assistant.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hosts/faunus-ater/modules/home-assistant.nix b/hosts/faunus-ater/modules/home-assistant.nix index 5e569e8..d7a59df 100644 --- a/hosts/faunus-ater/modules/home-assistant.nix +++ b/hosts/faunus-ater/modules/home-assistant.nix @@ -3,10 +3,23 @@ lib, config, ... -}: { +}: let + writeYaml = (pkgs.formats.yaml {}).generate; + + switches = writeYaml "switches.yaml" [ + { + platform = "wake_on_lan"; + mac = "88:AE:DD:0F:2A:1E"; + host = "tv.lan"; + name = "TV Power"; + turn_off.action = "shell_command.turn_off_tv"; + } + ]; +in { virtualisation.oci-containers.containers.home-assistant = { volumes = [ "/data/dirty/home-assistant:/config" + "${switches}:/config/switches.yaml" "${config.sops.secrets.power-management-key.path}:/root/.ssh/power-management-key" ]; environment.TZ = "Europe/Berlin";