This commit is contained in:
parent
5f644d0ccd
commit
a394b9cefd
167 changed files with 2795 additions and 2122 deletions
|
@ -1,4 +1,5 @@
|
|||
{pkgs, ...}: {
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
networking.firewall.interfaces."wg0" = {
|
||||
|
@ -10,25 +11,27 @@
|
|||
];
|
||||
};
|
||||
|
||||
systemd.services.vm-ubuntu = let
|
||||
start-vm = pkgs.writeShellApplication {
|
||||
name = "start-vm";
|
||||
runtimeInputs = with pkgs; [qemu];
|
||||
text = ''
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
-cpu host,kvm=on,hv-vendor_id="GenuineIntel" \
|
||||
-smp 4 \
|
||||
-m 8192 \
|
||||
-nic user,model=virtio-net-pci,hostfwd=tcp::60022-:22,hostfwd=tcp::8545-:8545 \
|
||||
-drive file=/var/lib/vm-ubuntu/ubuntu.qcow2
|
||||
'';
|
||||
systemd.services.vm-ubuntu =
|
||||
let
|
||||
start-vm = pkgs.writeShellApplication {
|
||||
name = "start-vm";
|
||||
runtimeInputs = with pkgs; [ qemu ];
|
||||
text = ''
|
||||
qemu-system-x86_64 \
|
||||
-enable-kvm \
|
||||
-cpu host,kvm=on,hv-vendor_id="GenuineIntel" \
|
||||
-smp 4 \
|
||||
-m 8192 \
|
||||
-nic user,model=virtio-net-pci,hostfwd=tcp::60022-:22,hostfwd=tcp::8545-:8545 \
|
||||
-drive file=/var/lib/vm-ubuntu/ubuntu.qcow2
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
after = [ "network.target" ];
|
||||
serviceConfig = {
|
||||
ExecStart = "${start-vm}/bin/start-vm";
|
||||
};
|
||||
};
|
||||
in {
|
||||
wantedBy = ["multi-user.target"];
|
||||
after = ["network.target"];
|
||||
serviceConfig = {
|
||||
ExecStart = "${start-vm}/bin/start-vm";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue