Add hardware config and fix hummelberg build

This commit is contained in:
Fabian Hauser 2022-04-11 15:05:05 +02:00
parent 1452c2a43d
commit b2f0797b01
15 changed files with 68 additions and 52 deletions

View file

@ -0,0 +1,38 @@
{ config, lib, pkgs, modulesPath, ... }: {
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
boot.initrd.availableKernelModules = [
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
"xhci_pci"
"ahci"
"virtio-pci"
"igb"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-amd" "uhid" ];
boot.extraModulePackages = [ ];
boot.kernelParams = [ "acpi_enforce_resources=lax" ];
hardware.cpu.amd.updateMicrocode = true;
nix.maxJobs = lib.mkDefault 24;
powerManagement.powerUpCommands = let
forceThunderboltOnScript =
pkgs.writeScriptBin "force-thunderbolt-power-on" ''
#!${pkgs.stdenv.shell}
#echo 'on' > '/sys/bus/pci/devices/0000:03:00.0/power/control'; #TODO: Is the main controller required?
THUNDERBOLT_DEVICES="$(${pkgs.pciutils}/bin/lspci -D | ${pkgs.gnugrep}/bin/grep -i thunderbolt | cut --delimiter=' ' --fields=1)"
echo "Force PCI power on all thunderbolt devices"
for DEVICE in $THUNDERBOLT_DEVICES; do
echo 'on' > "/sys/bus/pci/devices/$DEVICE/power/control"
done
'';
in "${forceThunderboltOnScript}/bin/force-thunderbolt-power-on";
}