1 { config, lib, pkgs, machineName, ... }:
3 hardware.cpu.intel.updateMicrocode = true;
4 powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
5 nix.maxJobs = lib.mkDefault 2;
19 hardware.acpilight.enable = true;
21 # https://bugzilla.kernel.org/show_bug.cgi?id=110941
22 boot.kernelParams = [ "intel_pstate=no_hwp" ];
23 boot.kernelModules = [ "kvm-intel" ];
24 boot.cleanTmpDir = true;
25 boot.tmpOnTmpfs = true;
26 boot.extraModulePackages = [
27 config.boot.kernelPackages.exfat-nofuse
32 device = "/dev/disk/by-id/ata-Samsung_SSD_850_PRO_128GB_S1SMNSAFC36436X";
33 configurationLimit = 3;
38 canTouchEfiVariables = false;
39 efiSysMountPoint = "/boot/efi";
42 #enableCryptodisk = true;
46 { device = "/dev/disk/by-partlabel/${machineName}_ssd_boot";
49 fileSystems."/boot/efi" =
50 { device = "/dev/disk/by-partlabel/${machineName}_ssd_efi";
54 { device = "/dev/disk/by-partlabel/${machineName}_ssd_swap";
57 cipher = "aes-xts-plain64";
58 source = "/dev/urandom";
64 algorithm = lib.mkDefault "zstd";
65 # There is little point creating a zram of greater
66 # than twice the size of memory
67 # since we expect a 2:1 compression ratio.
68 # Note that zram uses about 0.1% of the size of the disk
69 # when not in use so a huge zram is wasteful.
70 memoryPercent = lib.mkDefault 150;
71 # Linux supports multithreaded compression for 1 device since 3.15.
72 # See https://lkml.org/lkml/2014/2/28/404 for details.
73 swapDevices = lib.mkDefault 1;
75 boot.kernel.sysctl = {
76 # Increase cache pressure, which increases the tendency of the kernel to
77 # reclaim memory used for caching of directory and inode objects. You will use
78 # less memory over a longer period of time. The performance hit is negated by
79 # the downside of swapping sooner.
80 "vm.vfs_cache_pressure" = lib.mkDefault 500;
82 # Increasing how aggressively the kernel will swap memory pages since we are
84 "vm.swappiness" = lib.mkDefault 100;
86 # Background processes will start writing right away when it hits the 1% limit
87 "vm.dirty_background_ratio" = lib.mkDefault 1;
89 # The system won’t force synchronous I/O until it gets to 50% dirty_ratio.
90 "vm.dirty_ratio" = lib.mkDefault 50;
93 # The 32-bit host id of the machine, formatted as 8 hexadecimal characters.
94 # You should try to make this id unique among your machines.
95 # Manually generated with : head -c4 /dev/urandom | od -A none -t x4 | cut -d ' ' -f 2
96 networking.hostId = "ce53d0c3";
98 # none is the recommended elevator with ZFS (which has its own I/O scheduler)
99 # and/or for SSD, whereas HDD could use mq-deadline.
100 services.udev.extraRules = ''
101 # set none scheduler for non-rotating disks
102 ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="none"
105 boot.supportedFilesystems = [ "zfs" ];
106 boot.initrd.supportedFilesystems = [ "zfs" ];
107 boot.initrd.availableKernelModules = [
116 boot.zfs.forceImportAll = false;
117 boot.zfs.forceImportRoot = false;
118 boot.zfs.enableUnstable = false;
119 boot.zfs.requestEncryptionCredentials = true;
120 services.zfs.autoScrub.enable = true;
123 { device = "${machineName}/root";
127 { device = "${machineName}/nix";
130 /* Mounted by zfs-mount.service
131 fileSystems."/home" =
132 { device = "${machineName}/home";
135 fileSystems."/home/julm/documents" =
136 { device = "${machineName}/home/documents";
141 { device = "${machineName}/var";