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