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
35 # No pstore backend available on this system.
36 systemd.services.mount-pstore.enable = false;
40 device = "/dev/disk/by-id/ata-CT250MX500SSD1_2004E2849DD1";
41 configurationLimit = 3;
47 event = "video/brightnessdown.*";
48 action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
51 event = "video/brightnessup.*";
52 action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
59 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
60 00000001) # plugged in
61 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
67 { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
70 fileSystems."/boot/efi" =
71 { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
75 { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
78 cipher = "aes-xts-plain64";
79 source = "/dev/urandom";
85 algorithm = lib.mkDefault "zstd";
86 # There is little point creating a zram of greater
87 # than twice the size of memory
88 # since we expect a 2:1 compression ratio.
89 # Note that zram uses about 0.1% of the size of the disk
90 # when not in use so a huge zram is wasteful.
91 memoryPercent = lib.mkDefault 150;
92 # Linux supports multithreaded compression for 1 device since 3.15.
93 # See https://lkml.org/lkml/2014/2/28/404 for details.
94 swapDevices = lib.mkDefault 1;
96 boot.kernel.sysctl = {
97 # Increase cache pressure, which increases the tendency of the kernel to
98 # reclaim memory used for caching of directory and inode objects. You will use
99 # less memory over a longer period of time. The performance hit is negated by
100 # the downside of swapping sooner.
101 "vm.vfs_cache_pressure" = lib.mkDefault 500;
103 # Increasing how aggressively the kernel will swap memory pages since we are
105 "vm.swappiness" = lib.mkDefault 100;
107 # Background processes will start writing right away when it hits the 1% limit
108 "vm.dirty_background_ratio" = lib.mkDefault 1;
110 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
111 "vm.dirty_ratio" = lib.mkDefault 50;
114 # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
115 # You should try to make this id unique among your hosts.
116 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
117 networking.hostId = "ec2adb40";
119 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
120 # and/or for SSD, whereas HDD could use mq-deadline.
121 services.udev.extraRules = ''
122 # set none scheduler for non-rotating disks
123 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
126 boot.supportedFilesystems = [ "ntfs" "vfat" "zfs" ];
127 boot.initrd.supportedFilesystems = [ "zfs" ];
128 boot.initrd.availableKernelModules = [
137 boot.zfs.forceImportAll = false;
138 boot.zfs.forceImportRoot = false;
139 boot.zfs.enableUnstable = false;
140 boot.zfs.requestEncryptionCredentials = [ hostName ];
141 services.zfs.autoScrub.enable = true;
144 { device = "${hostName}/root";
148 { device = "${hostName}/nix";
151 fileSystems."/home/sevy" =
152 { device = "${hostName}/home";
155 fileSystems."/home/sevy/Documents" =
156 { device = "${hostName}/home/Documents";
159 fileSystems."/home/sevy/Images" =
160 { device = "${hostName}/home/Images";
163 fileSystems."/home/sevy/Téléchargements" =
164 { device = "${hostName}/home/Downloads";
167 fileSystems."/home/sevy/.thunderbird" =
168 { device = "${hostName}/home/Mails";
171 fileSystems."/home/sevy/Vidéos" =
172 { device = "${hostName}/home/Videos";
176 { device = "${hostName}/var";
179 fileSystems."/var/cache" =
180 { device = "${hostName}/var/cache";
183 fileSystems."/var/log" =
184 { device = "${hostName}/var/log";
187 fileSystems."/var/tmp" =
188 { device = "${hostName}/var/tmp";