From af3d70ccf06f5616da712a68fb1d5403b622b2da Mon Sep 17 00:00:00 2001 From: GHOSCHT <31184695+GHOSCHT@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:03:33 +0100 Subject: [PATCH] Arion: Add homeassistant --- hosts/franz/arion/default.nix | 1 + hosts/franz/arion/smarthome/arion-compose.nix | 33 +++++++++++++++++++ hosts/franz/arion/smarthome/arion-pkgs.nix | 6 ++++ hosts/franz/arion/smarthome/default.nix | 7 ++++ 4 files changed, 47 insertions(+) create mode 100644 hosts/franz/arion/smarthome/arion-compose.nix create mode 100644 hosts/franz/arion/smarthome/arion-pkgs.nix create mode 100644 hosts/franz/arion/smarthome/default.nix diff --git a/hosts/franz/arion/default.nix b/hosts/franz/arion/default.nix index 0f07302..eb96bb1 100644 --- a/hosts/franz/arion/default.nix +++ b/hosts/franz/arion/default.nix @@ -15,6 +15,7 @@ ./passwords ./media ./dashboard + ./smarthome ]; environment.systemPackages = with pkgs; [arion]; diff --git a/hosts/franz/arion/smarthome/arion-compose.nix b/hosts/franz/arion/smarthome/arion-compose.nix new file mode 100644 index 0000000..c98ad5c --- /dev/null +++ b/hosts/franz/arion/smarthome/arion-compose.nix @@ -0,0 +1,33 @@ +{pkgs, ...}: { + project.name = "smarthome"; + + networks.dmz = { + name = "dmz"; + external = true; + }; + + services = { + homeassistant.service = { + image = "ghcr.io/home-assistant/home-assistant:stable"; + container_name = "homeassistant"; + privileged = true; + labels = { + "traefik.enable" = "true"; + "traefik.http.routers.homeassistant.entrypoints" = "websecure"; + "traefik.http.routers.homeassistant.rule" = "Host(`home.ghoscht.com`)"; + "traefik.http.routers.homeassistant.tls" = "true"; + "traefik.http.routers.homeassistant.tls.certresolver" = "letsencrypt"; + "traefik.http.services.homeassistant.loadbalancer.server.port" = "8123"; + }; + volumes = [ + "/home/ghoscht/.docker/smarthome/homeassistant_data:/config" + "/etc/localtime:/etc/localtime:ro" + "/run/dbus:/run/dbus:ro" + ]; + restart = "always"; + networks = [ + "dmz" + ]; + }; + }; +} diff --git a/hosts/franz/arion/smarthome/arion-pkgs.nix b/hosts/franz/arion/smarthome/arion-pkgs.nix new file mode 100644 index 0000000..69aad13 --- /dev/null +++ b/hosts/franz/arion/smarthome/arion-pkgs.nix @@ -0,0 +1,6 @@ +# Instead of pinning Nixpkgs, we can opt to use the one in NIX_PATH +import { + # We specify the architecture explicitly. Use a Linux remote builder when + # calling arion from other platforms. + system = "x86_64-linux"; +} diff --git a/hosts/franz/arion/smarthome/default.nix b/hosts/franz/arion/smarthome/default.nix new file mode 100644 index 0000000..983c07a --- /dev/null +++ b/hosts/franz/arion/smarthome/default.nix @@ -0,0 +1,7 @@ +{config, ...}: { + virtualisation.arion = { + projects.smarthome.settings = { + imports = [./arion-compose.nix]; + }; + }; +}