summary refs log tree commit diff stats
path: root/system/settings/hardware/bare-metal.nix
blob: 7fd47513f674f356228915516d76192b994328d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{ config, pkgs, ... }:

{ environment.systemPackages = with pkgs; [
    fuse_exfat
    cryptsetup
    dmidecode
    hdparm
    pciutils
    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";
  };

  zramSwap = {
    enable = true;
    algorithm = "zstd";
  };
  boot.tmpOnTmpfs = true;

  fileSystems."/".options = [ "noatime" "nodiratime" ];
  fileSystems."/home".options = [ "noatime" "nodiratime" ];
}