Adding VMs to PATH: Difference between revisions
imported>Kisik21 Described a way to launch NixOS VMs on boot with only Nix |
imported>Kisik21 Added "restartIfChanged" parameter to allow VMs to be not restarted on configuration change |
||
| Line 48: | Line 48: | ||
network_options ? "", | network_options ? "", | ||
args ? "", | args ? "", | ||
diskimagefolder ? "/var/lib/nixos-vms" }: | diskimagefolder ? "/var/lib/nixos-vms", | ||
restartIfChanged ? true }: | |||
let | let | ||
nixos-system = configuration: (import <nixpkgs/nixos> { inherit configuration; }); | nixos-system = configuration: (import <nixpkgs/nixos> { inherit configuration; }); | ||
| Line 55: | Line 56: | ||
in { | in { | ||
systemd.services.${hostname} = { | systemd.services.${hostname} = { | ||
inherit after; | inherit after restartIfChanged; | ||
environment = { | environment = { | ||
QEMU_NET_OPTS = network_options; | QEMU_NET_OPTS = network_options; | ||