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";
27 # https://bugzilla.kernel.org/show_bug.cgi?id=110941
28 boot.kernelParams = [ "intel_pstate=no_hwp" ];
29 boot.kernelModules = [ "kvm-intel" ];
30 boot.cleanTmpDir = true;
31 boot.tmpOnTmpfs = true;
32 boot.extraModulePackages = [
33 #config.boot.kernelPackages.exfat-nofuse
38 device = "/dev/disk/by-id/ata-CT250MX500SSD1_2004E2849DD1";
39 configurationLimit = 3;
44 canTouchEfiVariables = false;
45 efiSysMountPoint = "/boot/efi";
48 #enableCryptodisk = true;
54 event = "video/brightnessdown.*";
55 action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
58 event = "video/brightnessup.*";
59 action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
66 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
67 00000001) # plugged in
68 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
74 { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
77 fileSystems."/boot/efi" =
78 { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
82 { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
85 cipher = "aes-xts-plain64";
86 source = "/dev/urandom";
92 algorithm = lib.mkDefault "zstd";
93 # There is little point creating a zram of greater
94 # than twice the size of memory
95 # since we expect a 2:1 compression ratio.
96 # Note that zram uses about 0.1% of the size of the disk
97 # when not in use so a huge zram is wasteful.
98 memoryPercent = lib.mkDefault 150;
99 # Linux supports multithreaded compression for 1 device since 3.15.
100 # See https://lkml.org/lkml/2014/2/28/404 for details.
101 swapDevices = lib.mkDefault 1;
103 boot.kernel.sysctl = {
104 # Increase cache pressure, which increases the tendency of the kernel to
105 # reclaim memory used for caching of directory and inode objects. You will use
106 # less memory over a longer period of time. The performance hit is negated by
107 # the downside of swapping sooner.
108 "vm.vfs_cache_pressure" = lib.mkDefault 500;
110 # Increasing how aggressively the kernel will swap memory pages since we are
112 "vm.swappiness" = lib.mkDefault 100;
114 # Background processes will start writing right away when it hits the 1% limit
115 "vm.dirty_background_ratio" = lib.mkDefault 1;
117 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
118 "vm.dirty_ratio" = lib.mkDefault 50;
121 # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
122 # You should try to make this id unique among your hosts.
123 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
124 networking.hostId = "ec2adb40";
126 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
127 # and/or for SSD, whereas HDD could use mq-deadline.
128 services.udev.extraRules = ''
129 # set none scheduler for non-rotating disks
130 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
133 boot.supportedFilesystems = [ "ntfs" "vfat" "zfs" ];
134 boot.initrd.supportedFilesystems = [ "zfs" ];
135 boot.initrd.availableKernelModules = [
144 boot.zfs.forceImportAll = false;
145 boot.zfs.forceImportRoot = false;
146 boot.zfs.enableUnstable = false;
147 boot.zfs.requestEncryptionCredentials = [ hostName ];
148 services.zfs.autoScrub.enable = true;
151 { device = "${hostName}/root";
155 { device = "${hostName}/nix";
158 fileSystems."/home/sevy" =
159 { device = "${hostName}/home";
162 fileSystems."/home/sevy/Documents" =
163 { device = "${hostName}/home/Documents";
166 fileSystems."/home/sevy/Images" =
167 { device = "${hostName}/home/Images";
170 fileSystems."/home/sevy/Téléchargements" =
171 { device = "${hostName}/home/Downloads";
174 fileSystems."/home/sevy/.thunderbird" =
175 { device = "${hostName}/home/Mails";
178 fileSystems."/home/sevy/Vidéos" =
179 { device = "${hostName}/home/Videos";
183 { device = "${hostName}/var";
186 fileSystems."/var/cache" =
187 { device = "${hostName}/var/cache";
190 fileSystems."/var/log" =
191 { device = "${hostName}/var/log";
194 fileSystems."/var/tmp" =
195 { device = "${hostName}/var/tmp";