{"slug": "migrating-my-home-assistant-instance-from-haos-to-nixos-on-proxmox", "title": "Migrating My Home Assistant Instance from HAOS to NixOS (On Proxmox)", "summary": "A Home Assistant user migrated a Home Assistant OS (HAOS) virtual machine on Proxmox to a NixOS VM, with the migration almost entirely driven by an LLM agent (Gemini) that audited the live HAOS instance via a Home Assistant API key, wrote the migration plan, generated the NixOS configuration, built a custom backup-import script and produced the cutover commands, according to the author's 05 Dec 2026 writeup. The agent's audit captured current software versions and VM specs, a dual-NIC setup with one interface on a trusted VLAN and a second on a locked-down IoT VLAN, a Zigbee USB dongle requiring passthrough, and two configured Home Assistant users. The author moved off HAOS because its UI-driven, abstracted model with Supervisor add-ons made YAML changes hard to track, while NixOS brings the setup into declarative, version-controlled code alongside the rest of the home server.", "body_md": "# Migrating my Home Assistant instance from HAOS to NixOS (on Proxmox)\n\n05 Dec 2026\nI recently migrated my [Home Assistant](https://www.home-assistant.io/) instance from a [Home Assistant OS (HAOS)](https://www.home-assistant.io/installation/linux#install-home-assistant-operating-system) VM on Proxmox to a NixOS VM, also on Proxmox.\n\nWhat made this migration especially interesting is that it was almost entirely **LLM-driven**: an agent (Gemini) audited my live HAOS instance, wrote the migration plan, generated the NixOS configuration, built a custom backup-import script, and produced the exact cutover commands.\n\nIf you’d like to watch the full walkthrough - including the first-try cutover on Proxmox - you can check out the companion video:\n\n## Why leave HAOS?\n\nI’m in the middle of migrating my Proxmox-based home server over to a NixOS-based home server. My current Proxmox host runs a collection of VMs (mostly running NixOS), and as a prerequisite step, I wanted to migrate the non-NixOS VMs over to NixOS first.\n\nHome Assistant was a clear candidate. Running Home Assistant OS as a VM has been stable and works well out of the box, *but* it’s heavily UI-driven, and when you inevitably have to drop into YAML, it becomes difficult to track what changed, when, and why. Even more importantly, it’s a bit too abstracted for my taste with the custom shell and Supervisor addons (or apps?) running external services (e.g. Zigbee2MQTT). Moving it to NixOS brings the whole setup into declarative, version-controlled code alongside the rest of my infrastructure.\n\nHowever, before committing to the move, I wanted to answer a simple question: **how feasible is it to migrate my existing HAOS setup to NixOS?**\n\n## Step 1: AI-driven introspection and feasability planning\n\nInstead of manually clicking through every settings page in HAOS to take inventory, I handed the discovery work over to Gemini.\n\nI wrote a short, one-paragraph prompt explaining the context along with what I wanted to evaluate. Then - and this was the crucial part - I generated a fresh Home Assistant API key and gave it to the agent, instructing it to poke around and introspect the running instance to figure out what existed today, what could move cleanly to NixOS, and what couldn’t. The Home Assistant API exposes quite a bit, which works well for this kind of workflow.\n\n```\nI want you to scope out the work required to setup HAOS on NixOS. Note that this is NOT part of the current plan, nor do I want you to update the current plan. I just want you to scope things out. HAOS currently doesnt have too many plugins installed: primary ones are Zigbee to MQTT, Shell (probably no longer needed).\n\nUI is available at http://192.168.30.10:8123/, and here is an API token: [REDACTED]\n\nDo whatever digging is needed and report back.\n```\n\nFrom this, Gemini was able to produe a full migration report (complete with an architecture diagram!) concluding that the migration was not only feasible, but relatively straightforward.\n\n### What the LLM uncovered\n\nGiving the agent direct API access let it surface details I might easily have overlooked during a manual audit:\n\n- **Versions & resource sizing:** It captured the current software versions and VM specs, and correctly noted that a lean NixOS VM could likely run on fewer CPU cores and less RAM than HAOS.\n- **Dual-NIC VLAN setup:** It detected that Home Assistant was using two separate network interfaces for network-level isolation:\n  - One NIC on my **trusted VLAN** , used to access the web UI and mobile app.\n  - A second NIC on a locked-down **IoT VLAN** , strictly for IoT device discovery.\n- One NIC on my \n- **USB dongle passthrough:** It spotted the attached**Zigbee USB dongle** that would need to be passed through and configured on the NixOS side.*(Side note: I’m a huge fan of Zigbee and highly recommend Zigbee devices whenever you have the option.)*\n- **Users:** It accounted for the two configured Home Assistant users.\n- **HAOS Supervisor add-ons:** Supervisor add-ons are special companion services that only exist inside HAOS. Gemini zeroed in on these right away and confirmed they could be swapped for native NixOS services, and one could be dropped altogether in favor of standard OpenSSH.\n- **Devices & integrations:** Using the API, it inventoried all devices and integrations and checked that every integration was natively packaged in Nixpkgs.\n- **Hidden/subtle dependencies:** One of its best catches was flagging an automation that copies Nest doorbell clips to an NFS mount. Setting up an NFS mount in NixOS is trivial, of course, but catching that dependency*before* cutover saved me from a silent breakage later.\n\n## Step 2: Building the NixOS config in a fresh context\n\nOnce I was happy with the report, I fed the generated plan into a fresh LLM session and had Gemini iterate on the actual implementation.\n\nThis is where NixOS really shines for AI-assisted infrastructure work: because the entire system is defined in code, the agent can build the configuration locally and get immediate, deterministic verification before anything ever touches Proxmox.\n\nWorking from the plan, Gemini produced three artifacts:\n\n1. **The NixOS configuration** for the Home Assistant VM (covering networking, native NixOS replacements for Supervisor add-ons, NFS mount, and OpenSSH)\n2. **A [`disko`](https://github.com/nix-community/disko)-based VM disk image** ready to import into Proxmox\n3. **A tailor-made migration script** to extract and import state from a backup of the running HAOS instance into the new VM\n\n### Code snippets\n\n```\n# hosts/sfax/default.nix\n{ lib, pkgs, modulesPath, ... }:\n\n{\n  imports = [\n    (modulesPath + \"/profiles/qemu-guest.nix\")\n\n    ../../shared/default.nix # config shared across all of my machines\n\n    ./disko.nix\n    ./home-assistant\n    ./proxy.nix # Nginx reverse proxy + LetsEncrypt via Cloudflare DNS\n    ./zigbee.nix\n  ];\n\n  # Setup my user (NixOS + Home Manager config)\n  ksiksi.users.aksiksi.enable = true;\n\n  # Bootloader\n  boot.loader.systemd-boot = {\n    enable = true;\n    configurationLimit = 50;\n  };\n  boot.loader.efi.canTouchEfiVariables = true;\n  boot.growPartition = true;\n\n  # Networking\n  systemd.network.networks = {\n    \"10-lan\" = {\n      matchConfig.MACAddress = \"...\"; # Trusted VLAN NIC\n      address = [ \"192.168.10.30/24\" ];\n      gateway = [ \"192.168.10.1\" ];\n      dns = [ \"192.168.10.2\" ]; # Pi-hole\n    };\n    \"11-iot\" = {\n      matchConfig.MACAddress = \"...\"; # Untrusted VLAN NIC\n      address = [ \"192.168.30.10/24\" ];\n    };\n    # Fallback DHCP when booted pre-cutover.\n    \"20-dhcp-fallback\" = {\n      matchConfig.Type = \"ether\";\n      networkConfig.DHCP = \"yes\";\n    };\n  };\n\n  # NFS client and automount\n  boot.supportedFilesystems = [ \"nfs\" ];\n  environment.systemPackages = [ pkgs.nfs-utils ];\n  services.rpcbind.enable = true;\n  systemd.mounts = [\n    {\n      type = \"nfs\";\n      what = \"192.168.10.3:/pool/home\";\n      where = \"/mnt/home\";\n      mountConfig.Options = \"nfsvers=4,async,noatime,nodiratime,defaults,nofail\";\n      wantedBy = [ \"multi-user.target\" ];\n    }\n  ];\n\n  # Proxmox integration\n  services.qemuGuest.enable = true;\n\n  nixpkgs.hostPlatform = lib.mkDefault \"x86_64-linux\";\n}\n# hosts/sfax/home-assistant/default.nix\n{ ... }:\n\n{\n  imports = [\n    ./tasks.nix # systemd timers to replace HA scripts/automations\n  ];\n\n  services.home-assistant = {\n    enable = true;\n    extraComponents = [\n      \"default_config\"\n      \"dhcp\"\n      \"mobile_app\"\n      \"mqtt\"\n      \"ssdp\"\n      \"usb\"\n      \"zeroconf\"\n      # ... other device/service integrations\n    ];\n    config = {\n      default_config = {};\n\n      homeassistant = {\n        allowlist_external_dirs = [ \"/mnt/home\" ];\n      };\n\n      logger.default = \"critical\";\n\n      # Migrated static config\n      automation = \"!include automations.yaml\";\n      script = \"!include scripts.yaml\";\n      scene = \"!include scenes.yaml\";\n\n      # Declarative config\n      \"automation nix\" = \"!include ${./automations.yaml}\";\n      \"script nix\" = \"!include ${./scripts.yaml}\";\n      \"scene nix\" = \"!include ${./scenes.yaml}\";\n\n      # Sidebar tab for Z2M\n      lovelace.dashboards.zigbee2mqtt-ui = {\n        mode = \"yaml\";\n        title = \"Zigbee2MQTT\";\n        icon = \"mdi:zigbee\";\n        show_in_sidebar = true;\n        require_admin = true;\n        filename = \"${./dashboards/z2m.yaml}\";\n      };\n    };\n  };\n}\n# hosts/sfax/disko.nix\n# Disko partitioning config used to generate a \"baked\" VM image ready for Proxmox\n{ lib, ... }:\n\n{\n  disko = {\n    memSize = 4096;\n    imageBuilder.imageFormat = \"qcow2\";\n\n    devices.disk.sda = {\n      type = \"disk\";\n      device = lib.mkDefault \"/dev/sda\";\n      imageName = \"sfax\";\n      imageSize = \"32G\";\n\n      content = {\n        type = \"gpt\";\n        partitions = {\n          esp = {\n            name = \"ESP\";\n            size = \"500M\";\n            type = \"EF00\";\n            content = {\n              type = \"filesystem\";\n              format = \"vfat\";\n              mountpoint = \"/boot\";\n              mountOptions = [ \"umask=0077\" ];\n            };\n          };\n          root = {\n            size = \"100%\";\n            content = {\n              type = \"filesystem\";\n              format = \"ext4\";\n              mountpoint = \"/\";\n              mountOptions = [ \"x-systemd.growfs\" ];\n            };\n          };\n        };\n      };\n    };\n  };\n}\n```\n\n## Step 3: Testing with a local VM\n\nBefore shipping the disk image over to Proxmox, NixOS makes it straightforward to go one step beyond a clean evaluation/build: booting the configuration in a local VM. This lets you verify that the system boots cleanly, services start up as expected, and there are no obvious runtime or configuration issues, without touching your running HAOS instance.\n\n```\n# 1. Build disko qcow2 image\n# This will boot the VM in QEMU, partition disks via disko, and finally run the NixOS installer.\nnix build .#nixosConfigurations.sfax.config.system.build.diskoImages\n\n# 2. Create a writable CoW overlay backed by the Nix store image\nnix shell nixpkgs#qemu_kvm -c qemu-img create -f qcow2 -b \"$(readlink -f result/sfax.qcow2)\" -F qcow2 /tmp/sfax-local.qcow2\n\n# 3. Boot locally in QEMU with KVM + UEFI + port forwards (SSH :2222, HA :18123, Z2M :18080)\nnix run nixpkgs#qemu_kvm -- \\\n   -machine q35 -enable-kvm -cpu host -smp 4 -m 4096 \\\n   -display none \\\n   -bios \"$(nix build nixpkgs#OVMF.fd --no-link --print-out-paths)/FV/OVMF.fd\" \\\n   -device virtio-scsi-pci,id=scsi0 \\\n   -drive file=/tmp/sfax-local.qcow2,if=none,id=hd0,format=qcow2 \\\n   -device scsi-hd,drive=hd0 \\\n   -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::18123-:8123,hostfwd=tcp::18080-:8080 \\\n   -device virtio-net-pci,netdev=net0\n\n# 4. Sanity checks (in another terminal)\nssh -p 2222 aksiksi@localhost -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \"hostname && systemctl is-active mosquitto home-assistant systemd-networkd && ip -br a\"\ncurl -sSI http://localhost:18123/ | head -n 5\n```\n\n## Step 4: Live cutover on Proxmox\n\nHere is how the cutover played out:\n\n```\n# 1. Copy qcow2 image to Proxmox\nrsync -avh --progress --copy-links result/sfax.qcow2 root@192.168.0.100:/tmp/sfax.qcow2\n\n# 2. Create VM 111 for staging (temporary MAC on VLAN 10 -> DHCP fallback)\nssh root@192.168.0.100 \"qm create 111 --name sfax --ostype l26 --machine q35 --bios ovmf --efidisk0 vmpool:1,efitype=4m,pre-enrolled-keys=0 --scsihw virtio-scsi-single --cores 4 --sockets 1 --memory 4096 --agent 1 --net0 virtio,bridge=vmbr0,firewall=1,tag=10\"\n\n# 3. Import qcow2 onto vmpool (lands at vm-111-disk-1 since efidisk0 took disk-0)\nssh root@192.168.0.100 \"qm importdisk 111 /tmp/sfax.qcow2 vmpool && rm -f /tmp/sfax.qcow2\"\n\n# 4. Attach disk and boot for staging\nssh root@192.168.0.100 \"qm set 111 --scsi0 vmpool:vm-111-disk-1,iothread=1 --boot order=scsi0 && qm start 111\"\n\n# 5. Deploy migrated HAOS backup onto staged VM via tailor-made migration script (replace <DHCP_IP>)\n# Also copies over Zigbee2MQTT state to keep existing devices paired on the new VM.\nnix run nixpkgs#python3 -- hosts/sfax/migrate-backup.py /tmp/manual.tar --deploy aksiksi@<DHCP_IP> --no-start\n\n# 6. Cut over: shut down sfax (111) + HAOS (101, disable autostart), assign VLAN MACs + Zigbee dongle, and start sfax\nssh root@192.168.0.100 \"qm shutdown 111 && qm shutdown 101 && qm set 101 --onboot 0\"\nssh root@192.168.0.100 \"qm set 111 --net0 virtio=[REDACTED],bridge=vmbr0,firewall=1,tag=10 --net1 virtio=[REDACTED],bridge=vmbr0,firewall=1,tag=30 --usb0 host=[REDACTED] --onboot 1 && qm start 111\"\n\n# 7. Allow sfax (192.168.10.30) on pool/home NFS export (if not already done)\nssh root@192.168.0.100 'zfs set sharenfs=\"sec=sys,rw=@192.168.10.20/32:@192.168.10.10/32:@192.168.10.30/32,crossmnt,no_subtree_check,insecure\" pool/home && zfs share -a'\n\n# 8. Verify HA + Zigbee2MQTT on production IP\ncurl -sSI http://192.168.10.30:8123/ | head -n 5\ncurl -sSI http://192.168.10.30:8080/ | head -n 5\n```\n\nThe VM booted cleanly into NixOS on Proxmox.", "url": "https://wpnews.pro/news/migrating-my-home-assistant-instance-from-haos-to-nixos-on-proxmox", "canonical_source": "https://assil.me/2026/12/05/migrate-home-assistant-haos-to-nixos.html", "published_at": "2026-12-06 05:36:57+00:00", "updated_at": "2026-12-06 06:15:01.825981+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "artificial-intelligence"], "entities": ["Home Assistant", "Home Assistant OS", "NixOS", "Proxmox", "Gemini", "Zigbee2MQTT"], "also_reported_by": [], "takeaway": "Handing an LLM agent a scoped Home Assistant API key let it inventory versions, VM specs, dual-NIC VLAN separation, USB dongle passthrough and users, then generate the NixOS config and cutover commands for a first-try migration.", "recommendation": {"advice": "For infrastructure migrations, give the agent a scoped API key and a one-paragraph scoping prompt so it inventories the live system before writing config and cutover commands.", "playbook": "agent-architecture", "playbook_url": "https://wpnews.pro/playbooks/agent-architecture"}, "alternates": {"html": "https://wpnews.pro/news/migrating-my-home-assistant-instance-from-haos-to-nixos-on-proxmox", "markdown": "https://wpnews.pro/news/migrating-my-home-assistant-instance-from-haos-to-nixos-on-proxmox.md", "text": "https://wpnews.pro/news/migrating-my-home-assistant-instance-from-haos-to-nixos-on-proxmox.txt", "jsonld": "https://wpnews.pro/news/migrating-my-home-assistant-instance-from-haos-to-nixos-on-proxmox.jsonld"}}