r2r-dev / nixos-vm-examples

Examples of how to build and run NixOS VMs with nix

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nixos-vm-examples

Some examples of how to declare VMs running NixOS, building them with nix, and doing things inside.

Motivation

NixOS makes it easy to build and run all kinds of VM images. This is especially when

  • testing configuration changes before applying them to real hardware
  • testing changes to NixOS code itself
  • building reproducible environments for others to reproduce issues or results

While the individual NixOS modules involved are well-documented, a set of good examples can help you to build a VM for your use case.

Examples

  • grub-test-vm:

    QEMU VM in which you can run nixos-rebuild to test changes to NixOS's GRUB bootloader installer.

Contributions of more examples are welcome!

They should be well-commented and contain running instructions for beginners (see the existing examples).

Usage

Clone this repo with git clone --recursive, because it contains a submodule to pin nixpkgs.

After switching branches/commits, run git submodule update --init --recursive to ensure the submodule is updated. Alternatively, run ./setup-git-hooks to enable automatic submodule updating upon git checkout and git rebase.

About

Examples of how to build and run NixOS VMs with nix


Languages

Language:Nix 91.4%Language:Shell 8.6%