From 261fea477e7a98364981c04b4489ad507ae2b210 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Sun, 7 Sep 2025 01:34:26 +0200 Subject: [PATCH] Add podman and home assistant --- hosts/nixos/hs/system.nix | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/hosts/nixos/hs/system.nix b/hosts/nixos/hs/system.nix index 8a45095..a97e47c 100644 --- a/hosts/nixos/hs/system.nix +++ b/hosts/nixos/hs/system.nix @@ -154,6 +154,46 @@ }; }; + # Container virtualization with Podman + virtualisation = { + podman = { + enable = true; + # Create a `docker` alias for podman, to use it as a drop-in replacement + dockerCompat = true; + # Required for containers under podman-compose to be able to talk to each other + defaultNetwork.settings.dns_enabled = true; + # Create macvlan network for Home Assistant + extraPackages = [ pkgs.netavark pkgs.aardvark-dns ]; + }; + # Enable OCI container support + oci-containers = { + backend = "podman"; + + containers.homeassistant = { + image = "ghcr.io/home-assistant/home-assistant:stable"; + + volumes = [ + "/home/yanlin/deploy/data/home/config:/config" + "/etc/localtime:/etc/localtime:ro" + "/run/dbus:/run/dbus:ro" + ]; + + environment = { + TZ = "Europe/Copenhagen"; + }; + + extraOptions = [ + "--privileged" # Required for USB device access + "--network=host" # Use host networking + "--device=/dev/ttyUSB0:/dev/ttyUSB0" # Sky Connect Zigbee dongle + "--device=/dev/dri:/dev/dri" # Hardware acceleration + ]; + + autoStart = true; + }; + }; + }; + # SnapRAID configuration for parity protection services.snapraid = { enable = true; @@ -201,6 +241,7 @@ ]; }; + # Enable smartd for disk health monitoring services.smartd = { enable = true;