epyc: nerf it

This commit is contained in:
raito 2023-08-13 01:21:32 +02:00
parent ada25e575f
commit 0e8785863e

View file

@ -1,6 +1,7 @@
{ lib
, config
, pkgs
, inputs
, ...
}:
@ -29,6 +30,17 @@ in
{ domain = "*"; item = "nofile"; type = "-"; value = "20480"; }
];
# Memory accounting techniques
systemd.services.nix-daemon.serviceConfig = {
MemoryAccounting = true;
MemoryMax = "225G";
MemoryHigh = "220G";
MemorySwapMax = "2G";
ManagedOOMSwap = "kill";
ManagedOOMMemoryPressure = "kill";
MemoryPressureWatch = "on";
};
nix = {
# Garbage-collect often
gc.automatic = true;
@ -38,23 +50,21 @@ in
# Randomize GC to avoid thundering herd effects.
gc.randomizedDelaySec = "1800";
# 2.11, 2.12 suffers from a bug with remote builders…
package = pkgs.nixVersions.nix_2_13;
# Inchallah, it works.
# package = lib.mkForce inputs.nixpkgs-unstable.legacyPackages.x86_64-linux.nixVersions.nix_2_17;
# should be enough?
nrBuildUsers = 128;
# https://github.com/NixOS/nix/issues/719
daemonCPUSchedPolicy = "batch";
daemonIOSchedClass = "best-effort";
daemonIOSchedPriority = 5;
settings = {
keep-outputs = true;
keep-derivations = true;
max-jobs = 42; # 64 is too much, it will explode the RAM for now. Let's keep it serious.
# in zfs we trust
fsync-metadata = lib.boolToString (!config.boot.isContainer or config.fileSystems."/".fsType != "zfs");
use-cgroups = true;
http-connections = 0;
auto-allocate-uids = true;
cores = 64; # 128 is too much, it will explode the RAM for now. Let's keep it serious.
max-jobs = 2; # Do not build more than 2 derivations at once in the event, both of them are too big, yes this is stupid, fix it in Nix.
fsync-metadata = true;
substituters = [
"https://nix-community.cachix.org"
"https://tum-dse.cachix.org"
@ -64,6 +74,14 @@ in
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"tum-dse.cachix.org-1:v67rK18oLwgO0Z4b69l30SrV1yRtqxKpiHodG4YxhNM="
];
experimental-features = [
"auto-allocate-uids"
"ca-derivations"
"cgroups"
"discard-references"
"fetch-closure"
"impure-derivations"
];
};
};