Cleaned up some stuff

This commit is contained in:
Erwin Boskma 2021-10-07 09:59:54 +02:00
parent 956a0e3bbc
commit 872c0b719d
Signed by: erwin
GPG key ID: 02C3C0D914C0012B
3 changed files with 33 additions and 52 deletions

View file

@ -30,15 +30,23 @@
system = "x86_64-linux"; system = "x86_64-linux";
nixosConfig = { vm1BiosConfig = {
boot = { boot = {
type = "qemu-bios"; type = "bios";
qemu = true; qemu = true;
grubInstallDevice = "/dev/vda"; grubInstallDevice = "/dev/vda";
}; };
core.enable = true; core.enable = true;
}; };
vm1UefiConfig = {
boot = {
type = "uefi";
qemu = true;
};
core.enable = true;
};
vm2Config = { vm2Config = {
boot = { boot = {
type = "uefi"; type = "uefi";
@ -76,22 +84,10 @@
name = "vm1"; name = "vm1";
NICs = [ "enp1s0" ]; NICs = [ "enp1s0" ];
kernelPackage = pkgs.linuxPackages; kernelPackage = pkgs.linuxPackages;
initrdMods = [ initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
"ahci" kernelMods = [ "kvm-amd" ];
"xhci_pci"
"virtio_pci"
"sr_mod"
"virtio_blk"
"virtio_net"
"virtio_mmio"
"virtio_scsi"
"9p"
"9pnet_virtio"
];
kernelMods =
[ "kvm-amd" "virtio_balloon" "virtio_console" "virtio_rng" ];
kernelParams = [ ]; kernelParams = [ ];
systemConfig = nixosConfig; systemConfig = vm1UefiConfig;
users = nixosUsers; users = nixosUsers;
@ -102,20 +98,8 @@
name = "vm2"; name = "vm2";
NICs = [ "enp1s0" ]; NICs = [ "enp1s0" ];
kernelPackage = pkgs.linuxPackages; kernelPackage = pkgs.linuxPackages;
initrdMods = [ initrdMods = [ "ahci" "xhci_pci" "sr_mod" ];
"ahci" kernelMods = [ "kvm-amd" ];
"xhci_pci"
"virtio_pci"
"sr_mod"
"virtio_blk"
"virtio_net"
"virtio_mmio"
"virtio_scsi"
"9p"
"9pnet_virtio"
];
kernelMods =
[ "kvm-amd" "virtio_balloon" "virtio_console" "virtio_rng" ];
kernelParams = [ ]; kernelParams = [ ];
systemConfig = vm2Config; systemConfig = vm2Config;
@ -124,13 +108,13 @@
cpuCores = 4; cpuCores = 4;
}; };
loki = host.mkHost { # loki = host.mkHost {
name = "loki"; # name = "loki";
NICs = [ "enp4s0" ]; # NICs = [ "enp4s0" ];
kernelPackage = pkgs.linuxPackages; # kernelPackage = pkgs.linuxPackages;
initrdMods = [ "nvme" "xhci_pci" "ahci" ]; # initrdMods = [ "nvme" "xhci_pci" "ahci" ];
kernelMods = [ "kvm-amd" ]; # kernelMods = [ "kvm-amd" ];
}; # };
}; };
}; };
} }

View file

@ -1,4 +1,4 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, modulesPath, ... }:
with lib; with lib;
let cfg = config.eb.boot; let cfg = config.eb.boot;
@ -70,12 +70,14 @@ in {
}; };
}) })
(mkIf (cfg.qemu) { (mkIf (cfg.qemu) {
boot.initrd.postDeviceCommands = '' boot.initrd = {
# Set the system time from the hardware clock to work around a availableKernelModules = [ "virtio_net" "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_scsi" "9p" "9pnet_virtio" ];
# bug in qemu-kvm > 1.5.2 where the VM clock is initialized kernelModules = [ "virtio_balloon" "virtio_console" "virtio_rng" ];
# to the *boot time* of the host. postDeviceCommands =
''
hwclock -s hwclock -s
''; '';
};
services.qemuGuest.enable = true; services.qemuGuest.enable = true;
}) })

View file

@ -1,8 +1,3 @@
{ pkgs, config, lib, ... }: { pkgs, config, lib, modulesPath, ... }: {
{ imports = [ ./boot ./core ./nixos ];
imports = [
./boot
./core
./nixos
];
} }