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";
}

View file

@ -0,0 +1,3 @@
{ config, lib, pkgs, modulesPath, ... }: {
hardware.rasdaemon = { enable = true; };
}

View file

@ -0,0 +1,34 @@
{ config, lib, pkgs, modulesPath, hardwareModules, ... }: {
imports = with hardwareModules; [
(modulesPath + "/installer/scan/not-detected.nix")
lenovo-thinkpad-t14
common-cpu-intel
common-pc-ssd
common-pc-laptop
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usb_storage"
"usbhid"
"sd_mod"
"rtsx_pci_sdmmc"
];
boot.kernelModules = [ "kvm-intel" ];
boot.blacklistedKernelModules = [ "nouveau" ];
# Ignore Alcor smartcard (gpg is not very smart)
# See https://ludovicrousseau.blogspot.com/2015/12/remove-andor-customize-pcsc-reader-names.html
systemd.services.pcscd.environment.PCSCLITE_FILTER_IGNORE_READER_NAMES =
"Alcor";
hardware.video.hidpi.enable = true;
# CPU Configuration
hardware.cpu.intel.updateMicrocode = true;
services.throttled.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
}

View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, nixos-hardware, modulesPath, ... }: {
imports = with nixos-hardware.nixosModules;
[
(modulesPath + "/installer/scan/not-detected.nix")
# TODO: Not relevant anymore anyway
];
boot.initrd.availableKernelModules =
[ "xhci_pci" "nvme" "usb_storage" "usbhid" "sd_mod" ];
boot.kernelModules = [ "kvm-intel" "qmi_wwan" ]; # TODO: qmi_wwan required?
environment.systemPackages = with pkgs; [
modemmanager
libmbim
libqmi
]; # TODO: this should not be required
# Ignore Realtek smartcard (gpg is not very smart)
# See https://ludovicrousseau.blogspot.com/2015/12/remove-andor-customize-pcsc-reader-names.html
systemd.services.pcscd.environment.PCSCLITE_FILTER_IGNORE_READER_NAMES =
"Realtek";
hardware.video.hidpi.enable = true;
# Power configuration
services.tlp.enable = true;
services.power-profiles-daemon.enable = false;
# CPU Configuration
hardware.cpu.intel.updateMicrocode = true;
services.throttled.enable = true;
powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
}