Files
devvm/assets/container
w3cjandClaude Opus 5.5 f0d8aea497 feat(smolvm): the nix layer on smolvm; refused on Docker, whose containers can't sandbox Nix's builds
smolvm runs no init system, so the nix layer's daemon starts the way the
docker layer's does: nix.sh starts it when there's no systemd (for a VM it's
added to in place), and assets/container/services.sh starts it after each
start (its pid in /run/nix-daemon.pid, counted only when that process is
nix-daemon). Its settings are /etc/conf.d/nix-daemon, devvm's alone, which
guest/sync.sh writes with the VM's proxy under network policy and removes
when it's off, restarting the daemon when the file changed. nix-layer is
native on smolvm.

Docker stays none, so devvm refuses the layer in one line (backend_lacks)
for a VM or a build. Tested on Docker Desktop with nix-layer let through:
the layer builds and substitutes (nix run nixpkgs#hello works), but every
build fails with "this system does not support the kernel namespaces that
are required for sandboxing", as its containers lack CAP_SYS_ADMIN, and the
layer's sandbox-fallback = false keeps Nix from building unsandboxed
without a word. Supporting it there needs sandbox = false or Sysbox, a
choice left open.

- nix.sh: OpenRC refused in one line for now; with no init system, the
  daemon started with /etc/conf.d/nix-daemon read.
- sync.sh: one block for nix-daemon's proxy, a systemd drop-in or
  /etc/conf.d/nix-daemon.
- Caps: smolvm's nix-layer native; Docker's comment says why it's none.
- e2e: smolvm's nix section (a nix VM with network policy: nix-daemon
  running with the VM's proxy, nix run nixpkgs#hello through it, a build in
  Nix's sandbox, network off and restart giving a daemon without it);
  Docker's base project refuses the nix layer in one line (both engines);
  Lima's nix section gains the sandboxed build. smol_others is exported for
  the last smolvm check, whose bash -c couldn't find it.
- Docs: internals/backends (nix-layer's row), backends (the table, smolvm's
  Nix works, Docker's can't-do list), using/images, internals/images,
  internals/smolvm (no init system), internals/network, contributing.

Review (security-audit skill, guidance mode): /etc/conf.d/nix-daemon is
written by root through sudo in a root-owned folder and holds only the
VM's own proxy URL, so services.sh, running as root, sources only what root
wrote; the pid file is root's and a stale one never makes devvm kill
another process (its comm is checked); the daemon gets no host value. The
Docker refusal keeps every Nix build sandboxed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-31 12:49:43 -07:00
..