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