synix/templates/microvm
sid 95a533c876
All checks were successful
Deploy docs / build-and-deploy (push) Successful in 3s
initial commit
2026-02-23 20:34:35 +01:00
..
config initial commit 2026-02-23 20:34:35 +01:00
modules initial commit 2026-02-23 20:34:35 +01:00
overlays initial commit 2026-02-23 20:34:35 +01:00
pkgs initial commit 2026-02-23 20:34:35 +01:00
.envrc initial commit 2026-02-23 20:34:35 +01:00
.gitignore initial commit 2026-02-23 20:34:35 +01:00
flake.nix initial commit 2026-02-23 20:34:35 +01:00
README.md initial commit 2026-02-23 20:34:35 +01:00

microvm

microvm NixOS configuration.

Setup

To be able to rebuild remotely and for convenient ssh access, add the uvm host to your Home Manager ssh configuration:

programs.ssh.matchBlocks = {
  uvm = {
    host = "uvm";
    hostname = "localhost";
    port = 2222;
    user = "root";
    checkHostIP = false;
  };
};

Create a new directory and initialize the template inside of it:

mkdir -p microvm
cd microvm
nix flake init -t git+https://git.sid.ovh/sid/synix#microvm

Add your public key to the NixOS configuration. See config/configuration.nix.

Usage

Run VM:

nix run .#microvm

Or with tmux:

tmux new-session -s microvm 'nix run .#microvm'

tmux is available in the Nix development shell.

SSH into VM:

ssh uvm

Remote rebuilding:

nix run .#rebuild <build-host> uvm

Note: <build-host> needs to be a remote host where you login as root via ssh with no password.

If you need to use remote sudo, you can also use synix's rebuild script for remote rebuilds. But then, the root user password cannot be empty:

rebuild -p . -H uvm -T uvm -B <build-host>

You might want to set up PAM's SSH agent Auth or use an askpass helper.