summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--system/settings/hardware/bare-metal.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/system/settings/hardware/bare-metal.nix b/system/settings/hardware/bare-metal.nix
index 998001c0..130c2d21 100644
--- a/system/settings/hardware/bare-metal.nix
+++ b/system/settings/hardware/bare-metal.nix
@@ -9,6 +9,15 @@
     usbutils
   ];
 
+  services.udev.extraRules = ''
+    # set scheduler for NVMe
+    ACTION=="add|change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none"
+    # set scheduler for SSD and eMMC
+    ACTION=="add|change", KERNEL=="sd[a-z]|mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"
+    # set scheduler for rotating disks
+    ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"
+  '';
+
   boot.kernel.sysctl = {
     "net.ipv4.tcp_allowed_congestion_control" = "illinois reno lp";
     "net.ipv4.tcp_congestion_control" = "illinois";