1 { config, lib, pkgs, hostName, ... }:
3 hardware.cpu.intel.updateMicrocode = true;
4 powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
20 # https://bugzilla.kernel.org/show_bug.cgi?id=110941
21 boot.kernelParams = [ "intel_pstate=no_hwp" ];
22 boot.kernelModules = [ "kvm-intel" ];
23 boot.cleanTmpDir = true;
24 boot.tmpOnTmpfs = true;
25 boot.extraModulePackages = [
26 config.boot.kernelPackages.exfat-nofuse
31 device = "/dev/disk/by-id/ata-CT250MX500SSD1_2004E2849DD1";
32 configurationLimit = 3;
37 canTouchEfiVariables = false;
38 efiSysMountPoint = "/boot/efi";
41 #enableCryptodisk = true;
47 event = "video/brightnessdown.*";
48 action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
51 event = "video/brightnessup.*";
52 action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
55 event = "ac_adapter/*";
60 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
61 00000001) # plugged in
62 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
70 { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
73 fileSystems."/boot/efi" =
74 { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
78 { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
81 cipher = "aes-xts-plain64";
82 source = "/dev/urandom";
88 algorithm = lib.mkDefault "zstd";
89 # There is little point creating a zram of greater
90 # than twice the size of memory
91 # since we expect a 2:1 compression ratio.
92 # Note that zram uses about 0.1% of the size of the disk
93 # when not in use so a huge zram is wasteful.
94 memoryPercent = lib.mkDefault 150;
95 # Linux supports multithreaded compression for 1 device since 3.15.
96 # See https://lkml.org/lkml/2014/2/28/404 for details.
97 swapDevices = lib.mkDefault 1;
99 boot.kernel.sysctl = {
100 # Increase cache pressure, which increases the tendency of the kernel to
101 # reclaim memory used for caching of directory and inode objects. You will use
102 # less memory over a longer period of time. The performance hit is negated by
103 # the downside of swapping sooner.
104 "vm.vfs_cache_pressure" = lib.mkDefault 500;
106 # Increasing how aggressively the kernel will swap memory pages since we are
108 "vm.swappiness" = lib.mkDefault 100;
110 # Background processes will start writing right away when it hits the 1% limit
111 "vm.dirty_background_ratio" = lib.mkDefault 1;
113 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
114 "vm.dirty_ratio" = lib.mkDefault 50;
117 # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
118 # You should try to make this id unique among your hosts.
119 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
120 networking.hostId = "ec2adb40";
122 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
123 # and/or for SSD, whereas HDD could use mq-deadline.
124 services.udev.extraRules = ''
125 # set none scheduler for non-rotating disks
126 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
129 boot.supportedFilesystems = [ "zfs" ];
130 boot.initrd.supportedFilesystems = [ "zfs" ];
131 boot.initrd.availableKernelModules = [
140 boot.zfs.forceImportAll = false;
141 boot.zfs.forceImportRoot = false;
142 boot.zfs.enableUnstable = false;
143 boot.zfs.requestEncryptionCredentials = [ hostName ];
144 services.zfs.autoScrub.enable = true;
147 { device = "${hostName}/root";
151 { device = "${hostName}/nix";
154 fileSystems."/home" =
155 { device = "${hostName}/home";
158 fileSystems."/home/sevy/Documents" =
159 { device = "${hostName}/home/documents";
163 { device = "${hostName}/var";
166 fileSystems."/var/cache" =
167 { device = "${hostName}/var/cache";
170 fileSystems."/var/log" =
171 { device = "${hostName}/var/log";
174 fileSystems."/var/tmp" =
175 { device = "${hostName}/var/tmp";