[UNMAINTAINED] lightweight NixOS images
Go to file
Julie B. 7cd669804a relicense
My specifications:
- Nix code should receive a permissive license, in part not to copyleft
away everyone's NixOS configurations for no good reason.
- The companion tool should be protected by copyleft.
- The templates should immediately rise to the public domain.
- It should be very clear which part falls under which license.

Based on that, I have selected the ISC and BSD-0 because they are short,
and the GNU General Public License version 3 or later as a copyleft
license.
2021-08-27 18:53:58 +02:00
checks relicense 2021-08-27 18:53:58 +02:00
lib add flake-compat 2021-06-27 11:11:20 +02:00
miniguest relicense 2021-08-27 18:53:58 +02:00
modules relicense 2021-08-27 18:53:58 +02:00
template relicense 2021-08-27 18:53:58 +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
COPYING.GPL3 relicense 2021-08-27 18:53:58 +02:00
COPYING.ISC relicense 2021-08-27 18:53:58 +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 relicense 2021-08-27 18:53:58 +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:bbjubjub2494/miniguest

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

nix-env -if https://github.com/bbjubjub2494/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:bbjubjub2494/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.