1 { config, lib, pkgs, hostName, ... }:
3 hardware.cpu.intel.updateMicrocode = true;
4 hardware.opengl.extraPackages = [
5 pkgs.intel-media-driver # LIBVA_DRIVER_NAME=iHD
6 pkgs.vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
10 powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
26 # https://bugzilla.kernel.org/show_bug.cgi?id=110941
27 boot.kernelParams = [ "intel_pstate=no_hwp" ];
28 boot.kernelModules = [ "kvm-intel" ];
29 boot.cleanTmpDir = true;
30 boot.tmpOnTmpfs = true;
31 boot.extraModulePackages = [
32 #config.boot.kernelPackages.exfat-nofuse
37 device = "/dev/disk/by-id/ata-CT250MX500SSD1_2004E2849DD1";
38 configurationLimit = 3;
43 canTouchEfiVariables = false;
44 efiSysMountPoint = "/boot/efi";
47 #enableCryptodisk = true;
53 event = "video/brightnessdown.*";
54 action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
57 event = "video/brightnessup.*";
58 action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
65 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
66 00000001) # plugged in
67 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
73 { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
76 fileSystems."/boot/efi" =
77 { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
81 { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
84 cipher = "aes-xts-plain64";
85 source = "/dev/urandom";
91 algorithm = lib.mkDefault "zstd";
92 # There is little point creating a zram of greater
93 # than twice the size of memory
94 # since we expect a 2:1 compression ratio.
95 # Note that zram uses about 0.1% of the size of the disk
96 # when not in use so a huge zram is wasteful.
97 memoryPercent = lib.mkDefault 150;
98 # Linux supports multithreaded compression for 1 device since 3.15.
99 # See https://lkml.org/lkml/2014/2/28/404 for details.
100 swapDevices = lib.mkDefault 1;
102 boot.kernel.sysctl = {
103 # Increase cache pressure, which increases the tendency of the kernel to
104 # reclaim memory used for caching of directory and inode objects. You will use
105 # less memory over a longer period of time. The performance hit is negated by
106 # the downside of swapping sooner.
107 "vm.vfs_cache_pressure" = lib.mkDefault 500;
109 # Increasing how aggressively the kernel will swap memory pages since we are
111 "vm.swappiness" = lib.mkDefault 100;
113 # Background processes will start writing right away when it hits the 1% limit
114 "vm.dirty_background_ratio" = lib.mkDefault 1;
116 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
117 "vm.dirty_ratio" = lib.mkDefault 50;
120 # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
121 # You should try to make this id unique among your hosts.
122 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
123 networking.hostId = "ec2adb40";
125 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
126 # and/or for SSD, whereas HDD could use mq-deadline.
127 services.udev.extraRules = ''
128 # set none scheduler for non-rotating disks
129 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
132 boot.supportedFilesystems = [ "ntfs" "vfat" "zfs" ];
133 boot.initrd.supportedFilesystems = [ "zfs" ];
134 boot.initrd.availableKernelModules = [
143 boot.zfs.forceImportAll = false;
144 boot.zfs.forceImportRoot = false;
145 boot.zfs.enableUnstable = false;
146 boot.zfs.requestEncryptionCredentials = [ hostName ];
147 services.zfs.autoScrub.enable = true;
150 { device = "${hostName}/root";
154 { device = "${hostName}/nix";
157 fileSystems."/home/sevy" =
158 { device = "${hostName}/home";
161 fileSystems."/home/sevy/Documents" =
162 { device = "${hostName}/home/Documents";
165 fileSystems."/home/sevy/Images" =
166 { device = "${hostName}/home/Images";
169 fileSystems."/home/sevy/Téléchargements" =
170 { device = "${hostName}/home/Downloads";
173 fileSystems."/home/sevy/.thunderbird" =
174 { device = "${hostName}/home/Mails";
177 fileSystems."/home/sevy/Vidéos" =
178 { device = "${hostName}/home/Videos";
182 { device = "${hostName}/var";
185 fileSystems."/var/cache" =
186 { device = "${hostName}/var/cache";
189 fileSystems."/var/log" =
190 { device = "${hostName}/var/log";
193 fileSystems."/var/tmp" =
194 { device = "${hostName}/var/tmp";