Skip to content

fix: add incus-agent systemd service to NixOS module#11

Merged
ethannortharc merged 11 commits intomainfrom
fix/nixos-incus-agent-service
Mar 10, 2026
Merged

fix: add incus-agent systemd service to NixOS module#11
ethannortharc merged 11 commits intomainfrom
fix/nixos-incus-agent-service

Conversation

@ethannortharc
Copy link
Copy Markdown
Owner

Summary

  • Add explicit incus-agent systemd service to devbox-module.nix
  • After nixos-rebuild switch, the new system config replaces the original image config
  • Without this service definition, the VM agent never restarts, making the VM unreachable via incus exec

Test plan

  • devbox create --name test --tools go on Incus/Linux completes successfully
  • After nixos-rebuild, incus-agent restarts and VM remains reachable

🤖 Generated with Claude Code

ethan and others added 11 commits March 10, 2026 18:48
…re boot for Incus' (#4) from fix/incus-nixos-image into main

Reviewed-on: https://git.giomni.com/ethan/devbox/pulls/4
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ioning

incus exec doesn't source NixOS login profile, so system binaries
(sudo, base64, nixos-generate-config) in /run/current-system/sw/bin/
aren't in PATH. Also wait for DNS to be ready before downloading packages.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The images:nixos/25.11 Incus image has no nix channels configured,
causing nixos-rebuild to fail with "nixpkgs/nixos not found". Also
ensure the user's home directory exists before writing config files,
since the user is created by nixos-rebuild via devbox-module.nix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tivity

- devbox doctor now checks incusbr0 bridge, IP forwarding, iptables
  FORWARD rules, NAT masquerade, and tests VM connectivity on Linux
- devbox create now fails fast with actionable fix commands if the VM
  has no internet, instead of silently timing out on every download

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Explicitly set NIX_PATH to include the channel profile path so
  nixos-rebuild can find <nixpkgs/nixos> after nix-channel --update
- Run interactive incus exec sessions as the non-root user (UID >= 1000)
  with correct HOME and /workspace as working directory
- Make channel update interactive so progress is visible

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
exec_cmd always runs as root (needed for provisioning). New
exec_as_user method runs interactive sessions as the first non-root
user with correct HOME and /workspace CWD. Also fixes NIX_PATH to
include channel profile path for nixos-rebuild.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
nixos-rebuild switch stops incus-agent during activation, dropping the
websocket (exit 255). Now we detect this, wait for the agent to restart,
then continue provisioning. Also default Incus VMs to 4GiB memory since
NixOS rebuild evaluation needs 2-4GB (default 1GB causes OOM kills).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
After nixos-rebuild switch, the new system config replaces the original
image config. Without an explicit incus-agent service definition, the
agent never restarts, making the VM unreachable via `incus exec`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@ethannortharc ethannortharc merged commit df489a9 into main Mar 10, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant