Files
nix-dotfiles-v2/hosts/legolas/hardware-configuration.nix
T

106 lines
2.9 KiB
Nix

{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
#boot.kernelPackages = pkgs.linuxPackages_zen;
boot.kernelPackages = pkgs.linuxPackages_latest;
boot.kernelParams = lib.mkForce [
# s2idle (modern standby) instead of deep (S3): the Phison E21 NVMe
# controller (Corsair MP600 ELITE) hangs on resume from the D3 transition
# that S3 forces. s2idle avoids that path.
"mem_sleep_default=s2idle"
"nvme_core.default_ps_max_latency_us=0"
"pcie_aspm=off"
# from hardware config we are overriding away the deep sleep of.
"i915.enable_guc=2"
"i915.enable_fbc=1"
"i915.enable_psr=2"
];
boot.initrd.availableKernelModules = [
"xhci_pci"
"nvme"
"uas"
"rtsx_pci_sdmmc"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-label/NIXROOT";
fsType = "ext4";
};
fileSystems."/boot" = {
device = "/dev/disk/by-label/NIXBOOT";
fsType = "vfat";
options = [
"fmask=0022"
"dmask=0022"
];
};
boot.initrd.luks.devices.luks_secure = {
device = "/dev/disk/by-uuid/c21c8089-29a7-4266-a8a6-6e80ccca167c";
crypttabExtraOpts = [
#"tpm2-device=auto"
#"tpm2-measure-pcr=yes"
];
};
boot.kernel.sysctl = {
# "vm.swappiness" = 10;
};
systemd.targets.hibernate.enable = false;
powerManagement.enable = true;
# Disable hibernation
systemd.sleep = {
settings.Sleep = {
AllowHibernation = "no";
AllowHybridSleep = "no";
AllowSuspendThenHibernate = "no";
};
};
# Lid close must NOT suspend. The Phison E21 NVMe hangs on resume from any
# system suspend, and logind defaults to HandleLidSwitch=suspend (the trigger
# that kills the drive). Ignore the lid at the logind level; niri's
# switch-events handler still locks the session via noctalia, so the laptop
# stays on (RAM powered, s0idle) but never enters the death path.
services.logind.settings.Login = {
HandleLidSwitch = "ignore";
HandleLidSwitchExternalPower = "ignore";
HandleLidSwitchDocked = "ignore";
};
# Keep runtime PM off on the NVMe controller and its parent root port, and
# disable PCIe wakeup events. (The previous d3cold_allowed rule was a no-op:
# that sysfs attribute doesn't exist on this Phison endpoint or its root port.)
services.udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="pci", DRIVER=="pcieport", ATTR{power/wakeup}="disabled"
ACTION=="add", SUBSYSTEM=="pci", KERNEL=="0000:6e:00.0", ATTR{power/control}="on"
ACTION=="add", SUBSYSTEM=="pci", KERNEL=="0000:00:1d.0", ATTR{power/control}="on"
'';
hardware.graphics = {
enable = true;
extraPackages = with pkgs; [ vpl-gpu-rt ];
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}