42 lines
858 B
Nix
42 lines
858 B
Nix
|
{ lib, config, ... }:
|
||
|
with lib;
|
||
|
let
|
||
|
cfg = config.n.host.hardware;
|
||
|
in {
|
||
|
options.n.host.hardware = {
|
||
|
cpu = mkOption { type = types.str; default = ""; };
|
||
|
};
|
||
|
config = mkMerge [
|
||
|
(mkIf (cfg.cpu == "amd")
|
||
|
{
|
||
|
boot.kernelModules = [ "kvm-amd" ];
|
||
|
hardware.cpu.amd.updateMicrocode = true;
|
||
|
}
|
||
|
)
|
||
|
(mkIf (cfg.cpu == "intel")
|
||
|
{
|
||
|
hardware.cpu.intel.updateMicrocode = true;
|
||
|
}
|
||
|
)
|
||
|
(mkIf (cfg.cpu == "virt")
|
||
|
{
|
||
|
boot.initrd.availableKernelModules = [
|
||
|
"virtio_net"
|
||
|
"virtio_pci"
|
||
|
"virtio_mmio"
|
||
|
"virtio_blk"
|
||
|
"virtio_scsi"
|
||
|
"9p"
|
||
|
"9pnet_virtio"
|
||
|
];
|
||
|
boot.initrd.kernelModules = [
|
||
|
"virtio_balloon"
|
||
|
"virtio_console"
|
||
|
"virtio_rng"
|
||
|
"virtio_gpu"
|
||
|
];
|
||
|
}
|
||
|
)
|
||
|
];
|
||
|
}
|