Run a NixOS closure as a microVM with desktop integration
Find a file
Val Packett 604ebc1356 [BREAKING] Switch to virtgpu-based D-Bus tunneling
This introduces support for drag&drop and printing portals, and later
camera/screencasting should be possible as well. However we break
backwards compatibility with already built closures because the
nixosModule needs to be changed.

In the next commit, the runtime environment related services will be
removed from the nixosModule to prevent unnecessary future breakage.
2026-03-06 05:09:55 -03:00
devShells nix: devShell: add packages for proxy development 2026-01-29 20:54:07 -03:00
nixosModules [BREAKING] Switch to virtgpu-based D-Bus tunneling 2026-03-06 05:09:55 -03:00
packages Fork libkrun again to fix buffer mapping permission issue (fix #18) 2026-02-27 02:48:17 -03:00
templates/musictest fix(template): use structured settings for MPD audio output 2026-02-24 11:08:53 +01:00
.envrc Initial commit 2025-09-25 22:29:24 -03:00
.gitignore Introduce micro-activate (RIIR activate script + tiny bit of tmpfiles) 2025-12-04 07:17:31 -03:00
flake.lock [BREAKING] Switch to virtgpu-based D-Bus tunneling 2026-03-06 05:09:55 -03:00
flake.nix [BREAKING] Switch to virtgpu-based D-Bus tunneling 2026-03-06 05:09:55 -03:00
LICENSE.md Initial commit 2025-09-25 22:29:24 -03:00
micro-activate.rs Set up a monotonic clock boot time offset in the VM 2026-02-20 05:17:13 -03:00
munix [BREAKING] Switch to virtgpu-based D-Bus tunneling 2026-03-06 05:09:55 -03:00
README.md readme: move example to flake template 2025-12-15 16:12:56 +01:00

munix

WIP: A microVM runner for NixOS systems with desktop integration, powered by muvm/libkrun.

Quick Start

1. Build a test VM:

nix build '.#nixosConfigurations.testvm-x86_64.config.system.build.toplevel' -o testvm

2. Run the VM:

nix run '.#munix' -- testvm

This will start an interactive bash session inside the microVM.

Run a specific command:

nix run '.#munix' -- testvm fastfetch

Create a custom VM:

Use the template to bootstrap a new munix project:

mkdir my-vm && cd my-vm
nix flake init -t 'git+https://git.clan.lol/clan/munix#musictest'
git init && git add flake.nix
nix run

This creates a flake.nix with a music player demo (MPD + Euphonica). Edit the module to customize your VM.

munix Options

  • --uid UID, -u UID - Set microVM UID (default: 1337)
  • --gid GID, -g GID - Set microVM GID (default: 1337)
  • --no-gpu - Disable GPU acceleration
  • --no-wayland - Disable Wayland support
  • --no-pipewire - Disable PipeWire audio
  • --x11 - Enable X11 support
  • --bind SRC DST - Bind mount SRC to DST in the VM
  • --ro-bind SRC DST - Read-only bind mount
  • --expose PATH - Expose PATH in the VM at the same location
  • --ro-expose PATH - Expose PATH read-only

Example with options:

nix run '.#munix' -- --no-gpu --ro-expose /home/user/data testvm htop

Development

Working on muvm & munix locally (not built into the nix store):

cd muvm && cargo build --locked --release
PATH=$PWD/muvm/target/release:$PATH ./munix testvm

Requirements

  • Linux system with KVM support (/dev/kvm)
  • For GPU acceleration: Kernel 6.13+ with compatible drivers (amdgpu, msm)
  • For Wayland: XDG_RUNTIME_DIR and WAYLAND_DISPLAY set

Known Issues