58 lines
1.4 KiB
Nix
Raw Normal View History

2021-10-26 01:04:15 +03:00
{ lib, pkgs, config, ... }:
with config.deviceSpecific; {
2022-01-30 02:10:32 +03:00
zramSwap = {
enable = true;
algorithm = "zstd";
2023-03-27 20:57:06 +03:00
priority = 100;
memoryPercent = 100; # around 25% of memory
2022-01-30 02:10:32 +03:00
};
2022-12-14 23:46:25 +03:00
persist.state.files = [ "/etc/machine-id" ];
2023-03-27 20:57:06 +03:00
services.earlyoom = {
enable = devInfo.ram < 16;
freeMemThreshold = 5;
freeSwapThreshold = 100;
};
services.fstrim = lib.mkIf (devInfo.fileSystem != "zfs") {
enable = isSSD;
interval = "weekly";
};
services.zfs = lib.mkIf (devInfo.fileSystem == "zfs") {
autoScrub.enable = true;
autoScrub.interval = "weekly";
trim.enable = isSSD;
trim.interval = "weekly";
};
boot = {
2021-02-07 02:38:11 +03:00
loader = {
2021-09-16 01:03:52 +03:00
timeout = lib.mkForce 4;
2023-03-27 20:57:06 +03:00
systemd-boot.enable = lib.mkDefault
pkgs.hostPlatform.system == "x86_64-linux";
2021-02-07 02:38:11 +03:00
};
2023-03-27 20:57:06 +03:00
kernelParams =
[ "zswap.enabled=0" "quiet" "scsi_mod.use_blk_mq=1" "modeset" "nofb" ]
2022-12-14 23:51:59 +03:00
++ lib.optionals (pkgs.hostPlatform.system == "x86_64-linux") [
2021-09-16 01:03:52 +03:00
"rd.systemd.show_status=auto"
"rd.udev.log_priority=3"
"pti=off"
"spectre_v2=off"
2022-02-11 14:07:03 +03:00
"kvm.ignore_msrs=1"
2021-09-16 01:03:52 +03:00
];
2023-03-27 20:57:06 +03:00
kernelPackages = lib.mkDefault pkgs.linuxPackages_lqx;
2021-02-07 02:38:11 +03:00
consoleLogLevel = 3;
kernel.sysctl = {
"vm.swappiness" = if config.deviceSpecific.isSSD then 1 else 10;
};
2022-08-05 21:10:22 +03:00
2023-03-25 19:30:34 +03:00
cleanTmpDir = !config.boot.tmpOnTmpfs;
2023-03-27 20:57:06 +03:00
zfs.forceImportAll = lib.mkDefault false;
2021-02-07 02:38:11 +03:00
};
}