put both files in a dir.
├── config.nix
└── flake.nix
- build or rebuild the vm:
nixos-rebuild build-vm --flake .#nixos- (might need
nix.settings.experimental-features = [ "nix-command" "flakes" ];in system config
or append--extra-experimental-features nix-command --extra-experimental-features flakesto the command)
- (might need
- run the vm:
./result/bin/run-nixos-vm - creates:
result -> /nix/store/hash-vmandnixos.qcow2 - reset vm:
rm result nixos.qcow2nixos.qcow2stores all the user settings/files.
that should add ssh port forwarding to the VM.
ssh localhost:2221