Zurück zum Ranking

microvm-nix/microvm.nix

Nixmicrovm-nix.github.io/microvm.nix/

NixOS MicroVMs

nixnixosmicrovmmicrovmsflakesflakenix-flakecloud-hypervisorcrosvmfirecrackerqemuvirtualization
Sterne-Wachstum
Sterne
2.8k
Forks
218
Wochenwachstum
Issues
43
1k2k
Juni 2021Feb. 2023Nov. 2024Juli 2026
README

MicroVM.nix

Handbook: HTML MarkdownMatrix chatChangelog Gradient Badge

Demo GIF

A Nix Flake to build NixOS and run it on one of several Type-2 Hypervisors on NixOS/Linux or macOS. The project is intended to provide a more isolated alternative to nixos-container. You can either build and run MicroVMs like Nix packages, or alternatively install them as systemd services declaratively in your host's Nix Flake or imperatively with the provided microvm command.

Project Presentation (video)

At a glance

  • MicroVMs are Virtual Machines but use special device interfaces (virtio) for high performance.
  • This project runs them on NixOS/Linux hosts and macOS (via vfkit).
  • You can choose from eight hypervisors for each MicroVM.
  • MicroVMs have a fixed RAM allocation (default: 512 MB) but can be shrunk using microvm-balloon
  • MicroVMs have a read-only root disk with either a prepopulated /nix/store or by mounting the host's along with an optional writable overlay. This filesystem can be built as either squashfs (smaller) or erofs (faster).
  • You define your MicroVMs in a Nix Flake's nixosConfigurations section, reusing the nixosModules that are exported by this Flake.
  • MicroVMs can access stateful filesystems either on a image volume as a block device, or alternatively as a shared directory hierarchy through 9p or virtiofs.
  • Zero, one, or more virtual tap ethernet network interfaces can be attached to a MicroVM. qemu, kvmtool, and vfkit also support user networking which requires no additional setup on the host.
  • For high-throughput TAP networking with qemu, enable tap.vhost = true to use vhost-net kernel acceleration (~10 Gbps vs ~1.5 Gbps without).

Hypervisors

Hypervisor Language Restrictions
qemu C
cloud-hypervisor Rust no 9p shares
firecracker Rust no 9p/virtiofs shares
crosvm Rust 9p shares broken
kvmtool C no virtiofs shares, no control socket
stratovirt Rust no 9p/virtiofs shares, no control socket
alioth Rust no virtiofs shares, no control socket
vfkit Go macOS only, no 9p shares, no tap/bridge networking

Installation

nix registry add microvm github:microvm-nix/microvm.nix

(If you do not want to inflict this change on your system, just replace microvm with github:microvm-nix/microvm.nix in the following examples.)

Start writing your own NixOS MicroVM definitions

nix flake init -t microvm
$EDITOR flake.nix
nix run .#my-microvm

Examples

Run MicroVMs on your local machine

nix run microvm#qemu-example
nix run microvm#firecracker-example
nix run microvm#cloud-hypervisor-example
nix run microvm#crosvm-example
nix run microvm#kvmtool-example
nix run microvm#stratovirt-example

# On macOS only:
nix run microvm#vfkit-example

Run a MicroVM example with nested MicroVMs on 5 different Hypervisors

nix run microvm#vm

Check networkctl status virbr0 for the DHCP leases of the nested MicroVMs. They listen for ssh with an empty root password.

Experimental: run graphical applications with graphics support

On Linux with cloud-hypervisor and Wayland forwarding:

nix run microvm#graphics neverball

On macOS with vfkit, enable graphics with microvm.graphics.enable = true.

Commercial support

Accelerate your operations and secure your infrastructure with support from a team of virtualization experts. Contact Cyberus Technology: https://www.cyberus-technology.de/contact


Looking for help or customization?

Get in touch with Numtide to get a quote. We make it easy for companies to work with Open Source projects: https://numtide.com/contact

Ähnliche Repositories
unionlabs/union

The trust-minimized, zero-knowledge bridging protocol, designed for censorship resistance, extremely high security, and usage in decentralized finance.

Rustcrates.ioApache License 2.0blockchaincosmos
union.build
73.9k3.9k
NixOS/nixpkgs

Nix Packages collection & NixOS

NixMIT Licensenixpkgsnix
25.5k19.6k
NixOS/nix

Nix, the purely functional package manager

C++GNU Lesser General Public License v2.1nixfunctional-programming
nixos.org
17.4k2k
jetify-com/devbox

Instant, easy, and predictable development environments

GoGo ModulesApache License 2.0devboxdevelopment-environment
jetify.com/devbox/
12.2k347
nix-community/home-manager

Manage a user environment using Nix [maintainer=@khaneliman, @rycee]

NixMIT Licensenixnixpkgs
nix-community.github.io/home-manager/
10.1k2.4k
xonsh/xonsh

🐚 Python-powered shell. Full-featured, cross-platform and AI-friendly.

PythonPyPIOtherxonshdevops
xon.sh
9.6k730
teslamate-org/teslamate

A self-hosted data logger for your Tesla 🚘 [main maintainer=@JakobLichterfeld]

ElixirGNU Affero General Public License v3.0teslatesla-api
docs.teslamate.org
8.8k991
cachix/devenv

Fast, Declarative, Reproducible, and Composable Developer Environments using Nix

Rustcrates.ioApache License 2.0developer-toolsdevenv
devenv.sh
7.2k525
RubyMetric/chsrc

chsrc 全平台通用换源工具与框架. Change Source everywhere for every software

CGNU General Public License v3.0gemlinux
chsrc.run
6.8k277
nix-darwin/nix-darwin

Manage your macOS using Nix

NixMIT Licensedarwinnix
nix-darwin.org
5.7k649
digitallyinduced/ihp

🔥 The fastest way to build type safe web apps. IHP is a new batteries-included web framework optimized for longterm productivity and programmer happiness

HaskellMIT Licensehaskellpostgresql
ihp.digitallyinduced.com
5.3k223
nix-community/awesome-nix

😎 A curated list of the best resources in the Nix community [maintainer=@cyntheticfox]

Creative Commons Zero v1.0 Universalawesome-listawesome
nix-community.github.io/awesome-nix/
5.3k203