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;