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";
61 event = "ac_adapter/*";
66 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
67 00000001) # plugged in
68 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
76 { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
79 fileSystems."/boot/efi" =
80 { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
84 { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
87 cipher = "aes-xts-plain64";
88 source = "/dev/urandom";
94 algorithm = lib.mkDefault "zstd";
95 # There is little point creating a zram of greater
96 # than twice the size of memory
97 # since we expect a 2:1 compression ratio.
98 # Note that zram uses about 0.1% of the size of the disk
99 # when not in use so a huge zram is wasteful.
100 memoryPercent = lib.mkDefault 150;
101 # Linux supports multithreaded compression for 1 device since 3.15.
102 # See https://lkml.org/lkml/2014/2/28/404 for details.
103 swapDevices = lib.mkDefault 1;
105 boot.kernel.sysctl = {
106 # Increase cache pressure, which increases the tendency of the kernel to
107 # reclaim memory used for caching of directory and inode objects. You will use
108 # less memory over a longer period of time. The performance hit is negated by
109 # the downside of swapping sooner.
110 "vm.vfs_cache_pressure" = lib.mkDefault 500;
112 # Increasing how aggressively the kernel will swap memory pages since we are
114 "vm.swappiness" = lib.mkDefault 100;
116 # Background processes will start writing right away when it hits the 1% limit
117 "vm.dirty_background_ratio" = lib.mkDefault 1;
119 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
120 "vm.dirty_ratio" = lib.mkDefault 50;
123 # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
124 # You should try to make this id unique among your hosts.
125 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
126 networking.hostId = "ec2adb40";
128 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
129 # and/or for SSD, whereas HDD could use mq-deadline.
130 services.udev.extraRules = ''
131 # set none scheduler for non-rotating disks
132 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
135 boot.supportedFilesystems = [ "ntfs" "vfat" "zfs" ];
136 boot.initrd.supportedFilesystems = [ "zfs" ];
137 boot.initrd.availableKernelModules = [
146 boot.zfs.forceImportAll = false;
147 boot.zfs.forceImportRoot = false;
148 boot.zfs.enableUnstable = false;
149 boot.zfs.requestEncryptionCredentials = [ hostName ];
150 services.zfs.autoScrub.enable = true;
153 { device = "${hostName}/root";
157 { device = "${hostName}/nix";
160 fileSystems."/home/sevy" =
161 { device = "${hostName}/home";
164 fileSystems."/home/sevy/Documents" =
165 { device = "${hostName}/home/Documents";
168 fileSystems."/home/sevy/Images" =
169 { device = "${hostName}/home/Images";
172 fileSystems."/home/sevy/Téléchargements" =
173 { device = "${hostName}/home/Downloads";
176 fileSystems."/home/sevy/.thunderbird" =
177 { device = "${hostName}/home/Mails";
180 fileSystems."/home/sevy/Vidéos" =
181 { device = "${hostName}/home/Videos";
185 { device = "${hostName}/var";
188 fileSystems."/var/cache" =
189 { device = "${hostName}/var/cache";
192 fileSystems."/var/log" =
193 { device = "${hostName}/var/log";
196 fileSystems."/var/tmp" =
197 { device = "${hostName}/var/tmp";