[UNMAINTAINED] lightweight NixOS images
Go to file
2021-08-27 18:53:57 +02:00
checks boot.miniguest.{hypervisor => guestType} 2021-08-27 18:53:57 +02:00
lib add flake-compat 2021-06-27 11:11:20 +02:00
miniguest add option to override bundled nix 2021-07-02 22:33:40 +02:00
modules boot.miniguest.{hypervisor => guestType} 2021-08-27 18:53:57 +02:00
template boot.miniguest.{hypervisor => guestType} 2021-08-27 18:53:57 +02:00
.envrc add git hooks 2021-07-02 21:27:24 +02:00
.gitignore add defaultTemplate 2021-07-04 21:11:05 +02:00
default.nix add nix-build compat 2021-07-02 21:27:24 +02:00
devshell.toml improve devShell 2021-07-04 17:11:21 +02:00
flake.lock add devShell 2021-06-27 11:11:20 +02:00
flake.nix refactor NixOS module 2021-07-09 23:10:48 +02:00
LICENSE add License 2021-06-26 22:57:36 +02:00
README.md add defaultTemplate 2021-07-04 21:11:05 +02:00
shell.nix add flake-compat 2021-06-27 11:11:20 +02:00

Low-footprint NixOS images

This tool makes lightweight NixOS virtual machines and containers for popular virtualisation tools. The guest systems live entirely on the host's Nix store. The host system does not need to be NixOS.

How lightweight?

Lighter than if it were the host system. There is no disk image, no bootloader, no ISO. Just plain immutable file that are friendly to Nix's deduplication mechanisms.

Support Vector

Libvirt KVM guests are the current primary focus. Any hypervisor that is capable of direct-kernel boot can most likely work as well. Libvirt OS containers will come in the future.

Installation

If the Nix you drive already has flakes enabled, just use the following command:

nix profile install github:lourkeur/miniguest

Otherwise don't worry, miniguest can be bootstrapped under Nix 2.3 and older with with:

nix-env -if https://github.com/lourkeur/miniguest/archive/refs/heads/master.zip

If you do not have Nix installed, refer to this page, then look at the second command.

Getting started

You base your flake on the template. Copy the template/ directory from the repository, or run:

nix flake new -t github:lourkeur/miniguest

Usage

Guest system configuration must be presented within a Nix flake, import the nixosModules.miniguest module from the miniguest flake, and set boot.miniguest.enable to true. The miniguest tool can then be invoked with

sudo miniguest install «flakePath»#«guestName»

The configuration will then be built and will appear under /etc/miniguests/«guestName».

It is recommended to create at most one domain per configuration so that they can all be rebuilt independently of each other.

  • nixos-container: Miniguest takes inspiration from NixOS's containers, however, containers wraps systemd-nspawn, whereas miniguests delegates actual guest management to any supported hypervisor.

  • nixos-rebuild build-vm: Miniguest borrows the store-sharing mechanism from NixOS's built-in lightweight QEMU VMs when applicable, but it lets libvirt take care of the VM configuration and lifecycle.