NixOS:nixos-rebuild build-vm: Difference between revisions

imported>ErnstderLage
m add --max-jobs
imported>ErnstderLage
m add alternative
Line 56: Line 56:
=== Still can't login after updating configuration ===
=== 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.
== Alternatives ==
===  Bootable ISO ===
Build it as a [https://nix.dev/tutorials/nixos/building-bootable-iso-image bootable ISO image]:
=== VM ===
<syntaxhighlight lang="nix">
{
...
  imports = [
    <nixos/nixos/modules/virtualisation/virtualbox-image.nix> ]
...
</syntaxhighlight>
<code>
nix build -f '<nixpkgs/nixos>' -I nixos-config=./configuration.nix config.system.build.virtualBoxOVA
</code>
[https://discourse.nixos.org/t/nixos-rebuild-build-vm-not-portable-across-linux-distributions/28564/4 Source]