Storage
Shared Nix store, per-VM software, and private data.
Dom0 manages a shared global Nix store, so VMs can reuse packages without storing separate copies. Each NixOS VM has a system closure: its configured software and everything that software needs to run.
Each other NixOS VM receives a read-only view of its own closure. It does not receive unrestricted access to the global store or other VMs' private files. This lets a VM have a minimal software surface, containing only what its role requires.
EROFS store views
Airlock uses EROFS, a read-only filesystem, to present each NixOS guest's closure at
/nix/store. Each view has an EROFS metadata image describing its files and
directories, plus a separate data device supplying the file contents.
Dom0 keeps package contents as immutable fragments in a shared storage pool. For each closure, it builds a metadata image and a map of the fragments that closure needs. Linux device mapper assembles those ranges into a read-only block device. Qubes exposes the metadata image and mapped data device to the VM through Xen block devices.
The mapped device contains only the fragments selected for that closure. A VM cannot read other packages in the pool by bypassing the filesystem and reading its data device directly.
In this example, both VMs use package A. Their metadata images refer to the same stored package contents through separate block mappings, so A does not need to be copied into each VM's disk. Package B is exposed only to VM 1, and package C only to VM 2.
Build stores
Build-capable VMs, including sys-ctrl and usr-assistant, have separate writable
build stores. They can reuse supplied dependencies and write build outputs
without write access to the global store.
These build stores combine an EROFS view of supplied dependencies with a private writable overlay. New build outputs go into that writable layer while the shared package contents remain read-only.
Private data
Personal files and application data live in writable private storage. That data persists independently of machine generations, so rolling back the system does not restore an earlier version of a document or application database.