# virtio-fs Prerequisites Verification

## Date: 2026-01-26

This document verifies that all prerequisites for virtio-fs support are available in nixpkgs.

## Requirements Summary

virtio-fs requires:
1. **QEMU 4.2.0+** - vhost-user-fs device support introduced
2. **virtiofsd daemon** - User-space filesystem daemon for virtio-fs
3. **Guest kernel CONFIG_VIRTIO_FS** - Linux 5.4+ with virtio-fs driver enabled

---

## Verification Results

### 1. QEMU Version

**Command:**
```bash
nix eval nixpkgs#qemu.version --raw
```

**Result:**
```
10.1.2
```

**Status:** ✅ **PASS** - Version 10.1.2 is significantly newer than the required 4.2.0

**Notes:**
- QEMU 10.x includes full virtio-fs support with vhost-user-fs backend
- Package provides `qemu-kvm` as main program
- Multiple outputs available: out, doc, ga, debug

---

### 2. virtiofsd Package

**Command:**
```bash
nix search nixpkgs virtiofsd --json
```

**Result:**
```
legacyPackages.x86_64-linux.virtiofsd
```

**Version Check:**
```bash
nix eval nixpkgs#virtiofsd.version --raw
```

**Version:**
```
1.13.2
```

**Status:** ✅ **PASS** - virtiofsd is available as a standalone package

**Notes:**
- virtiofsd is available in nixpkgs as a separate package
- Version 1.13.2 is a modern Rust-based implementation
- This is the newer rust-virtiofsd, not the original C implementation from QEMU

---

### 3. Kernel CONFIG_VIRTIO_FS Support

**Command:**
```bash
nix-shell -p linux --run "zcat /proc/config.gz | grep CONFIG_VIRTIO_FS"
```

**Kernel Version:**
```bash
nix eval nixpkgs#linux.version --raw
```

**Version:** `6.12.63`

**Result:**
```
CONFIG_VIRTIO_FS=m
```

**Status:** ✅ **PASS** - virtio-fs is enabled as a loadable kernel module

**Notes:**
- Linux kernel 6.12.63 is much newer than the required 5.4+
- CONFIG_VIRTIO_FS is compiled as a module (`=m`)
- Module will be available in NixOS VM builds by default
- virtio-fs driver can be loaded on-demand

---

## NixOS-Specific Considerations

### Module Loading
- Kernel module `virtiofs` will need to be loaded in the guest
- NixOS typically handles this automatically via `boot.initrd.availableKernelModules` or runtime modprobe

### QEMU Integration
- QEMU package in nixpkgs is the full-featured build
- Includes vhost-user-fs device support
- No custom QEMU build needed

### virtiofsd Daemon
- Must be started on the host before launching VM
- Requires socket path for communication with QEMU
- NixOS can manage this via systemd if desired

---

## Conclusion

**✅ ALL PREREQUISITES AVAILABLE**

All required components for virtio-fs are present in nixpkgs:
- ✅ QEMU 10.1.2 (requirement: 4.2.0+)
- ✅ virtiofsd 1.13.2 (standalone package)
- ✅ Linux kernel 6.12.63 with CONFIG_VIRTIO_FS=m (requirement: 5.4+)

**No blockers identified.** We can proceed with virtio-fs implementation.

---

## Next Steps

1. Design virtiofsd socket/daemon management strategy
2. Update QEMU launch arguments to use vhost-user-fs-pci device
3. Configure guest kernel to mount virtio-fs filesystems
4. Update NixOS VM flake to include virtiofsd in systemPackages or as a service
