Cheatsheet: Difference between revisions

imported>Mic92
No edit summary
imported>Mic92
more vm goodies
Line 360: Line 360:
</source>
</source>


To be able to log in you will need a getty started on a serial console as well in your nixos configuration:
<source lang="nix">
{...}: {
  # ..
  systemd.services."serial-getty@ttyS0".enable = true;
}
</source>
To forward a port you can set export `QEMU_NET_OPTS`. In the following example port 2222 on the host is forwarded to port 22 in the vm:
<source lang="console">
$ export QEMU_NET_OPTS="hostfwd=tcp::2222-:22"
</source>
Don't forget that by default nixos comes with a firewall enabled:
<source lang="nix">
{...}: {
  networking.firewall.enable = false;
}
</source>
=== Reuse a package as a build environment ===
=== Reuse a package as a build environment ===
As packages already contains all build dependencies, they can be reused to a build environment quickly.
As packages already contains all build dependencies, they can be reused to a build environment quickly.