Initial commit
This commit is contained in:
41
modules/n/hardware.nix
Normal file
41
modules/n/hardware.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{ 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"
|
||||
];
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
Reference in New Issue
Block a user