2024-04-28 15:54:53 +00:00
|
|
|
# Surface Pro 9
|
2024-05-07 22:02:59 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
pkgs,
|
|
|
|
modulesPath,
|
|
|
|
...
|
|
|
|
}:
|
2024-07-03 19:10:33 +00: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 22:02:59 +00:00
|
|
|
{
|
|
|
|
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
|
|
|
|
|
|
|
|
boot = {
|
2024-08-13 00:09:08 +00:00
|
|
|
# Enable antenna aggregation
|
|
|
|
extraModprobeConfig = ''
|
|
|
|
options iwlwifi 11n_disable=8
|
|
|
|
'';
|
|
|
|
|
2024-05-07 22:02:59 +00:00
|
|
|
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 18:26:32 +00:00
|
|
|
kernel.sysctl = {
|
|
|
|
# Try to reduce swappiness - Khanda hates paging, even to NVMe storage
|
|
|
|
"vm.swappiness" = 20;
|
|
|
|
};
|
|
|
|
|
2024-05-07 22:02:59 +00: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 19:10:33 +00:00
|
|
|
# Configure the main filesystem.
|
2024-07-04 01:13:13 +00:00
|
|
|
aux.system.filesystem = {
|
2024-07-05 13:36:11 +00:00
|
|
|
enable = true;
|
|
|
|
partitions = {
|
|
|
|
boot = "/dev/disk/by-uuid/${bootUUID}";
|
|
|
|
luks = "/dev/disk/by-uuid/${luksUUID}";
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
2024-07-05 13:36:11 +00:00
|
|
|
swapFile = {
|
2024-07-03 19:10:33 +00:00
|
|
|
enable = true;
|
2024-07-05 13:36:11 +00:00
|
|
|
size = 16384;
|
2024-05-07 22:02:59 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-07-07 14:48:51 +00: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 18:36:28 +00: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 22:02:59 +00:00
|
|
|
|
|
|
|
# Install/configure additional drivers, particularly for touch
|
|
|
|
environment.systemPackages = with pkgs; [ libwacom-surface ];
|
|
|
|
|
2024-07-03 21:47:59 +00:00
|
|
|
# NOTE: Uncomment to use a default kernel and skip full kernel rebuilds
|
|
|
|
# boot.kernelPackages = lib.mkForce pkgs.linuxPackages_latest;
|
2024-04-23 18:46:17 +00:00
|
|
|
}
|