1.5 KiB
1.5 KiB
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'
tmuxis 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.