NixOS:nixos-rebuild build-vm: Difference between revisions
Restructured page, add more text more sections |
m fix sectioning |
||
Line 64: | Line 64: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Troubleshooting = | |||
== Still can't login after updating configuration == | |||
When running a virtual machine a file called <code>$hostname.qcow2</code> is created in your current working directory. After changing your <code>/etc/nixos/configuration.nix</code> delete this file, rebuild and then start the new virtual machine. Now you should be able to login. | When running a virtual machine a file called <code>$hostname.qcow2</code> is created in your current working directory. After changing your <code>/etc/nixos/configuration.nix</code> delete this file, rebuild and then start the new virtual machine. Now you should be able to login. | ||
= Networking = | |||
== qemu == | |||
To enable connecting from your host to your virtual machine, you'll need to forcefully override the default networking settings to apply those from https://wiki.qemu.org/Documentation/Networking#How_to_get_SSH_access_to_a_guest instead. For example, to expose the VM's port 80 on the (unprivileged) port 8009 of the 'localhost' of the host: | To enable connecting from your host to your virtual machine, you'll need to forcefully override the default networking settings to apply those from https://wiki.qemu.org/Documentation/Networking#How_to_get_SSH_access_to_a_guest instead. For example, to expose the VM's port 80 on the (unprivileged) port 8009 of the 'localhost' of the host: | ||
Line 93: | Line 93: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
= Alternatives = | |||
== Bootable ISO == | |||
Build it as a [https://nix.dev/tutorials/nixos/building-bootable-iso-image bootable ISO image]: | Build it as a [https://nix.dev/tutorials/nixos/building-bootable-iso-image bootable ISO image]: | ||
== VM == | |||
<syntaxhighlight lang="nix"> | <syntaxhighlight lang="nix"> | ||
{ | { |