67 lines
2.1 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";
memoryPercent = 60;
numDevices = 1;
};
boot = if !isServer && !isISO then {
2021-02-07 02:38:11 +03:00
loader = {
2021-09-16 01:03:52 +03:00
timeout = lib.mkForce 4;
systemd-boot.enable = pkgs.system == "x86_64-linux";
2021-02-07 02:38:11 +03:00
};
2022-01-30 02:10:32 +03:00
kernelParams = [ "zswap.enabled=0" "quiet" "scsi_mod.use_blk_mq=1" "modeset" "nofb" ]
2021-09-16 01:03:52 +03:00
++ lib.optionals (pkgs.system == "x86_64-linux") [
"rd.systemd.show_status=auto"
"rd.udev.log_priority=3"
"pti=off"
"spectre_v2=off"
];
2021-09-28 01:38:09 +03:00
kernelPackages = pkgs.linuxPackages_zen;
2021-02-07 02:38:11 +03:00
supportedFilesystems = [ "ntfs" ];
extraModprobeConfig = lib.mkIf (config.device == "AMD-Workstation") ''
options snd slots=snd_virtuoso,snd_usb_audio
'';
consoleLogLevel = 3;
kernel.sysctl = {
"vm.swappiness" = if config.deviceSpecific.isSSD then 1 else 10;
};
2022-01-30 02:10:32 +03:00
} else if isServer then {
2022-01-29 00:50:24 +03:00
kernelPackages = pkgs.linuxPackages_5_15_hardened;
2021-10-26 01:04:15 +03:00
kernelModules = [ "tcp_bbr" ];
2022-01-30 02:10:32 +03:00
kernelParams = [ "zswap.enabled=0" ];
2021-10-26 01:04:15 +03:00
kernel.sysctl = {
"kernel.sysrq" = 0;
"net.ipv4.icmp_echo_ignore_broadcasts" = 1;
"net.ipv4.icmp_ignore_bogus_error_responses" = 1;
"net.ipv4.conf.default.rp_filter" = 1;
"net.ipv4.conf.all.rp_filter" = 1;
"net.ipv4.tcp_syncookies" = 1;
"net.ipv4.conf.all.accept_redirects" = 0;
"net.ipv4.conf.default.accept_redirects" = 0;
"net.ipv4.conf.all.secure_redirects" = 0;
"net.ipv4.conf.default.secure_redirects" = 0;
"net.ipv6.conf.all.accept_redirects" = 0;
"net.ipv6.conf.default.accept_redirects" = 0;
"net.ipv4.conf.all.send_redirects" = 0;
"net.ipv4.conf.all.accept_source_route" = 0;
"net.ipv6.conf.all.accept_source_route" = 0;
"net.ipv4.tcp_rfc1337" = 1;
"net.ipv4.tcp_fastopen" = 3;
"net.ipv4.tcp_congestion_control" = "bbr";
"net.core.default_qdisc" = "cake";
};
2022-01-30 02:10:32 +03:00
} else {
kernelPackages = lib.mkForce pkgs.linuxPackages_latest;
kernelParams = lib.mkForce [ "zswap.enabled=0" ];
supportedFilesystems = lib.mkForce [ "ext4" "vfat" "btrfs" "ntfs" ];
2021-02-07 02:38:11 +03:00
};
}