1 { config, lib, pkgs, hostName, ... }:
3 hardware.cpu.intel.updateMicrocode = true;
4 powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
7 # FIXME: uncomment when updating to 21.05
34 # https://bugzilla.kernel.org/show_bug.cgi?id=110941
35 boot.kernelParams = [ "intel_pstate=no_hwp" ];
36 boot.kernelModules = [ "kvm-intel" ];
37 boot.cleanTmpDir = true;
38 boot.tmpOnTmpfs = true;
39 boot.extraModulePackages = [
40 config.boot.kernelPackages.exfat-nofuse
45 device = "/dev/disk/by-id/ata-CT250MX500SSD1_2004E2849DD1";
46 configurationLimit = 3;
51 canTouchEfiVariables = false;
52 efiSysMountPoint = "/boot/efi";
55 #enableCryptodisk = true;
61 event = "video/brightnessdown.*";
62 action = "${pkgs.acpilight}/bin/xbacklight -dec 10";
65 event = "video/brightnessup.*";
66 action = "${pkgs.acpilight}/bin/xbacklight -inc 10";
69 event = "ac_adapter/*";
74 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g powersave;;
75 00000001) # plugged in
76 ${pkgs.linuxPackages.cpupower}/bin/cpupower frequency-set -g ondemand;;
84 { device = "/dev/disk/by-partlabel/${hostName}_ssd_boot";
87 fileSystems."/boot/efi" =
88 { device = "/dev/disk/by-partlabel/${hostName}_ssd_efi";
92 { device = "/dev/disk/by-partlabel/${hostName}_ssd_swap";
95 cipher = "aes-xts-plain64";
96 source = "/dev/urandom";
102 algorithm = lib.mkDefault "zstd";
103 # There is little point creating a zram of greater
104 # than twice the size of memory
105 # since we expect a 2:1 compression ratio.
106 # Note that zram uses about 0.1% of the size of the disk
107 # when not in use so a huge zram is wasteful.
108 memoryPercent = lib.mkDefault 150;
109 # Linux supports multithreaded compression for 1 device since 3.15.
110 # See https://lkml.org/lkml/2014/2/28/404 for details.
111 swapDevices = lib.mkDefault 1;
113 boot.kernel.sysctl = {
114 # Increase cache pressure, which increases the tendency of the kernel to
115 # reclaim memory used for caching of directory and inode objects. You will use
116 # less memory over a longer period of time. The performance hit is negated by
117 # the downside of swapping sooner.
118 "vm.vfs_cache_pressure" = lib.mkDefault 500;
120 # Increasing how aggressively the kernel will swap memory pages since we are
122 "vm.swappiness" = lib.mkDefault 100;
124 # Background processes will start writing right away when it hits the 1% limit
125 "vm.dirty_background_ratio" = lib.mkDefault 1;
127 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
128 "vm.dirty_ratio" = lib.mkDefault 50;
131 # The 32-bit host id of the host, formatted as 8 hexadecimal characters.
132 # You should try to make this id unique among your hosts.
133 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
134 networking.hostId = "ec2adb40";
136 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
137 # and/or for SSD, whereas HDD could use mq-deadline.
138 services.udev.extraRules = ''
139 # set none scheduler for non-rotating disks
140 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
143 boot.supportedFilesystems = [ "ntfs" "vfat" "zfs" ];
144 boot.initrd.supportedFilesystems = [ "zfs" ];
145 boot.initrd.availableKernelModules = [
154 boot.zfs.forceImportAll = false;
155 boot.zfs.forceImportRoot = false;
156 boot.zfs.enableUnstable = false;
157 boot.zfs.requestEncryptionCredentials = [ hostName ];
158 services.zfs.autoScrub.enable = true;
161 { device = "${hostName}/root";
165 { device = "${hostName}/nix";
168 fileSystems."/home/sevy" =
169 { device = "${hostName}/home";
172 fileSystems."/home/sevy/Documents" =
173 { device = "${hostName}/home/Documents";
176 fileSystems."/home/sevy/Images" =
177 { device = "${hostName}/home/Images";
180 fileSystems."/home/sevy/Téléchargements" =
181 { device = "${hostName}/home/Downloads";
184 fileSystems."/home/sevy/.thunderbird" =
185 { device = "${hostName}/home/Mails";
188 fileSystems."/home/sevy/Vidéos" =
189 { device = "${hostName}/home/Videos";
193 { device = "${hostName}/var";
196 fileSystems."/var/cache" =
197 { device = "${hostName}/var/cache";
200 fileSystems."/var/log" =
201 { device = "${hostName}/var/log";
204 fileSystems."/var/tmp" =
205 { device = "${hostName}/var/tmp";