Right now there's no option for NixOS users to configure the IO schedulers for the disk block devices.
To do this right now, one has to write an activation script that iterates over each block device and sets the IO scheduler.
Something like this:
system.activationScripts.diskScheduler = ''
for path in "''${disks[@]}"; do
echo noop >/sys/block/$(
${pkgs.coreutils}/bin/basename $(
${pkgs.coreutils}/bin/readlink -f $path
)
)/queue/scheduler
done
'';
It would be really nice and robust, if NixOS had dedicated option to do this. It would have to be configurable on each block device. So it would not correspond to the fileSystems option. Instead it would be more closer to the swapDevices option. Perhaps we should have a blockDevices option in general that organises all the options relating to connected block devices (which would have to be separate from udev like devices).
The proper way to do this is to use udev.
For example, this is in my configuration:
services.udev.extraRules = ''
ACTION=="add|change", KERNEL=="[sv]d[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="bfq"
'';
Maybe we should have option, just because it's such a common thing, that generates a udev rule like the one mentioned?
We need to be allowed to set the IO scheduler for different devices differently. I suggest 2 kinds of settings, one that allows us to set it to be the same for all (any block device), another that sets individual ones. They can be combined so that you can set the scheduler for all, and then individual override it for specific devices.
Thank you for your contributions.
This has been automatically marked as stale because it has had no activity for 180 days.
If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.
Here are suggestions that might help resolve this more quickly:
Still important to me.
Most helpful comment
The proper way to do this is to use udev.
For example, this is in my configuration: