nixos-config/machines/hyper/hardware-configuration.nix

63 lines
1.7 KiB
Nix

# SPDX-FileCopyrightText: 2020-2024 Simon Bruder <simon@sbruder.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
{ config, lib, modulesPath, pkgs, ... }:
{
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot = {
# fan control configuration from https://gist.github.com/bakman2/e801f342aaa7cade62d7bd54fd3eabd8
kernelModules = [ "kvm-amd" "it87" ];
kernelParams = [
"acpi_enforce_resources=lax" # allow it87 to load
"ip=dhcp"
"iommu=pt"
"default_hugepagesz=1G"
"hugepagesz=1G"
"hugepages=90"
];
extraModulePackages = with config.boot.kernelPackages; [ it87 ];
extraModprobeConfig = ''
options it87 force_id=0x8688
options vfio-pci ids=8086:56a0,8086:4f90
softdep drm pre: vfio-pci
options kvm-amd nested=0 avic=1 npt=1
'';
loader = {
grub.enable = false;
systemd-boot.enable = true;
efi.canTouchEfiVariables = true;
};
initrd = {
availableKernelModules = [ "aesni_intel" "ahci" "ehci_pci" "nvme" "r8169" "sd_mod" "sr_mod" "usb_storage" "usbhid" "xhci_pci" ];
kernelModules = [ "dm-snapshot" ];
network.enable = true; # remote unlocking
luks.devices = {
root = {
name = "root";
device = "/dev/disk/by-uuid/63d366bd-5453-46b5-89d5-a61cbb828102";
preLVM = true;
allowDiscards = true;
};
};
};
};
fileSystems = {
"/" = {
device = "/dev/disk/by-uuid/53f4e762-39fa-41a6-8b78-4999d38e6e88";
fsType = "btrfs";
options = [ "discard=async" "noatime" "compress=zstd" ];
};
"/boot" = {
device = "/dev/disk/by-uuid/403C-02C1";
fsType = "vfat";
};
};
}