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