2024-04-28 11:54:53 -04:00
|
|
|
# Surface Pro 9
|
2024-05-07 18:02:59 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
modulesPath,
|
|
|
|
...
|
|
|
|
}:
|
2024-07-03 15:10:33 -04:00
|
|
|
let
|
|
|
|
bootUUID = "B2D7-96C3"; # The UUID of the boot partition.
|
|
|
|
luksUUID = "f5ff391a-f2ef-4ac3-9ce8-9f5ed950b212"; # The UUID of the locked LUKS partition.
|
|
|
|
in
|
2024-05-07 18:02:59 -04:00
|
|
|
{
|
|
|
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
|
|
|
|
|
|
|
boot = {
|
|
|
|
initrd = {
|
|
|
|
availableKernelModules = [
|
|
|
|
"surface_aggregator"
|
|
|
|
"surface_aggregator_registry"
|
|
|
|
"surface_aggregator_hub"
|
|
|
|
"surface_hid_core"
|
|
|
|
"hid_multitouch"
|
|
|
|
"8250_dw"
|
|
|
|
"intel_lpss"
|
|
|
|
"intel_lpss_pci"
|
|
|
|
"xhci_pci"
|
|
|
|
"thunderbolt"
|
|
|
|
"nvme"
|
|
|
|
"usb_storage"
|
|
|
|
"sd_mod"
|
|
|
|
"surface_kbd"
|
|
|
|
"pinctrl_tigerlake"
|
|
|
|
];
|
|
|
|
kernelModules = [
|
|
|
|
"surface_aggregator"
|
|
|
|
"surface_aggregator_registry"
|
|
|
|
"surface_aggregator_hub"
|
|
|
|
"surface_hid_core"
|
|
|
|
"surface_hid"
|
|
|
|
"hid_multitouch"
|
|
|
|
"8250_dw"
|
|
|
|
"intel_lpss"
|
|
|
|
"intel_lpss_pci"
|
|
|
|
"surface_kbd"
|
|
|
|
"pinctrl_tigerlake"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-06-21 14:26:32 -04:00
|
|
|
kernel.sysctl = {
|
|
|
|
# Try to reduce swappiness - Khanda hates paging, even to NVMe storage
|
|
|
|
"vm.swappiness" = 20;
|
|
|
|
};
|
|
|
|
|
2024-05-07 18:02:59 -04:00
|
|
|
kernelModules = [
|
|
|
|
"kvm-intel"
|
|
|
|
"surface_aggregator"
|
|
|
|
"surface_aggregator_registry"
|
|
|
|
"surface_aggregator_hub"
|
|
|
|
"surface_hid_core"
|
|
|
|
"surface_hid"
|
|
|
|
"hid_multitouch"
|
|
|
|
"8250_dw"
|
|
|
|
"intel_lpss"
|
|
|
|
"intel_lpss_pci"
|
|
|
|
"surface_kbd"
|
|
|
|
"pinctrl_tigerlake"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2024-07-03 15:10:33 -04:00
|
|
|
# Configure the main filesystem.
|
2024-07-03 21:13:13 -04:00
|
|
|
aux.system.filesystem = {
|
2024-07-05 09:36:11 -04:00
|
|
|
enable = true;
|
|
|
|
partitions = {
|
|
|
|
boot = "/dev/disk/by-uuid/${bootUUID}";
|
|
|
|
luks = "/dev/disk/by-uuid/${luksUUID}";
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
2024-07-05 09:36:11 -04:00
|
|
|
swapFile = {
|
2024-07-03 15:10:33 -04:00
|
|
|
enable = true;
|
2024-07-05 09:36:11 -04:00
|
|
|
size = 16384;
|
2024-05-07 18:02:59 -04:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-07 10:48:51 -04:00
|
|
|
# Change I/O scheduler to BFQ to try and reduce stuttering under load.
|
|
|
|
services.udev.extraRules = ''
|
|
|
|
ACTION=="add|change", KERNEL=="nvme0*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
|
|
|
|
'';
|
|
|
|
|
2024-06-08 14:36:28 -04:00
|
|
|
hardware = {
|
|
|
|
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
|
|
|
# Enable camera driver
|
|
|
|
# NOTE: Currently results in a build failure. For updates, see https://github.com/NixOS/nixpkgs/issues/303067
|
|
|
|
/*
|
|
|
|
ipu6 = {
|
|
|
|
enable = true;
|
|
|
|
platform = "ipu6ep";
|
|
|
|
};
|
|
|
|
*/
|
|
|
|
};
|
2024-05-07 18:02:59 -04:00
|
|
|
|
|
|
|
# Install/configure additional drivers, particularly for touch
|
|
|
|
environment.systemPackages = with pkgs; [ libwacom-surface ];
|
|
|
|
|
2024-07-03 17:47:59 -04:00
|
|
|
# NOTE: Uncomment to use a default kernel and skip full kernel rebuilds
|
|
|
|
# boot.kernelPackages = lib.mkForce pkgs.linuxPackages_latest;
|
2024-04-23 14:46:17 -04:00
|
|
|
}
|