about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <patryk@niedzwiedzinski.cyou>2024-10-20 17:52:57 +0200
committerPatryk Niedźwiedziński <patryk@niedzwiedzinski.cyou>2024-10-20 17:52:57 +0200
commit40c3297200760e515178bdf849529a7426cb39a2 (patch)
treeda68db577ec554e194ac74b2acfc3f2e361c8ddb
parent2eb1a14886e5290357285cab62e5ff5662b2fd56 (diff)
downloaddots-40c3297200760e515178bdf849529a7426cb39a2.tar.gz
dots-40c3297200760e515178bdf849529a7426cb39a2.zip
Home Assistant
-rw-r--r--machines/srv3/configuration.nix1
-rw-r--r--machines/srv3/home-assistant.nix20
2 files changed, 21 insertions, 0 deletions
diff --git a/machines/srv3/configuration.nix b/machines/srv3/configuration.nix
index d1fb4e2..3e42249 100644
--- a/machines/srv3/configuration.nix
+++ b/machines/srv3/configuration.nix
@@ -11,6 +11,7 @@ in
     imports =
       [
       ../../modules/obsidian-livesync.nix
+      ./home-assistant.nix
       ./hardware-configuration.nix
       ./cgit.nix
       ./noip.nix
diff --git a/machines/srv3/home-assistant.nix b/machines/srv3/home-assistant.nix
new file mode 100644
index 0000000..d8a4d1d
--- /dev/null
+++ b/machines/srv3/home-assistant.nix
@@ -0,0 +1,20 @@
+{ pkgs, ... }:
+{
+  virtualisation.oci-containers = {
+    backend = "docker";
+    containers.homeassistant = {
+      volumes = [ 
+        "/srv/home-assistant:/config"
+	"/etc/localtime:/etc/localtime:ro"
+	"/run/dbus:/run/dbus:ro"
+      ];
+      environment.TZ = "Europe/Warsaw";
+      image = "ghcr.io/home-assistant/home-assistant:stable"; # Warning: if the tag does not change, the image will not be updated
+      extraOptions = [ 
+        "--network=host" 
+      ];
+      autoStart = true;
+    };
+  };
+  networking.firewall.allowedTCPPorts = [ 8123 ];
+}