{ config, pkgs, ... }: { virtualisation.docker.enable = true; virtualisation.oci-containers.containers.openccu = { # Official RaspberryMatic image (contains the necessary CCU logic) image = "ghcr.io/openccu/openccu:latest"; autoStart = true; # These options are critical for: # 1. Swarm Networking (connecting to 'public') # 2. Hardware Access (GPIO/USB) extraOptions = [ "--privileged" # Required for internal systemd & hardware "--network=public" # Connects to your Swarm Overlay network "--device=/dev/raw-uart:/dev/raw-uart" "--device=/dev/eq3loop:/dev/eq3loop" "--device=/dev/ttyUSB0:/dev/ttyUSB0" # Pass the underlying USB too, just in case ]; # Map the web interface locally, or rely on Swarm IP ports = [ "80:80" ]; volumes = [ "/mnt/service/data/openccu:/usr/local" "/sys/fs/cgroup:/sys/fs/cgroup:ro" # Required for RaspberryMatic ]; }; }