always allow overcommit memory

This commit is contained in:
陈浩南 2023-07-22 00:45:24 +08:00
parent b9503264f9
commit bfa14be863
3 changed files with 13 additions and 9 deletions

View File

@ -76,7 +76,7 @@
"net.core.somaxconn" = 8388608;
"vm.oom_kill_allocating_task" = true;
"vm.oom_dump_tasks" = false;
"vm.overcommit_kbytes" = 22020096;
"vm.overcommit_memory" = 1;
"dev.i915.perf_stream_paranoid" = false;
};
};

View File

@ -6,11 +6,15 @@ inputs:
joystick.enable = mkOption { type = types.bool; default = false; };
printer.enable = mkOption { type = types.bool; default = false; };
sound.enable = mkOption { type = types.bool; default = false; };
cpu = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
};
config = let inherit (inputs.lib) mkMerge mkIf; in mkMerge
[
# bluetooth
(mkIf inputs.config.nixos.hardware.bluetooth.enable { hardware.bluetooth.enable = true; })
# joystick
(mkIf inputs.config.nixos.hardware.joystick.enable { hardware = { xone.enable = true; xpadneo.enable = true; }; })
# printer
(
mkIf inputs.config.nixos.hardware.printer.enable
{
@ -21,6 +25,7 @@ inputs:
};
}
)
# sound
(
mkIf inputs.config.nixos.hardware.sound.enable
{
@ -36,10 +41,16 @@ inputs:
".*\n([[:space:]]*)(--\\[\"session\\.suspend-timeout-seconds\"][^\n]*)[\n].*" content;
spaces = builtins.elemAt matched 0;
comment = builtins.elemAt matched 1;
config = "[\"session.suspend-timeout-seconds\"] = 0";
config = ''["session.suspend-timeout-seconds"] = 0'';
in
builtins.replaceStrings [(spaces + comment)] [(spaces + config)] content;
}
)
# cpu
{
hardware.cpu = builtins.listToAttrs (builtins.map
(name: { inherit name; value = { updateMicrocode = true; }; })
inputs.config.nixos.kernel.cpu);
}
];
}

View File

@ -2,7 +2,6 @@ inputs:
{
options.nixos.kernel = let inherit (inputs.lib) mkOption types; in
{
cpu = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
patches = mkOption { type = types.listOf (types.enum [ "hdmi" "cjktty" ]); default = []; };
};
config = let inherit (inputs.lib) mkMerge mkIf; inherit (inputs.localLib) mkConditional; in mkMerge
@ -27,12 +26,6 @@ inputs:
});
};
}
# cpu
{
hardware.cpu = builtins.listToAttrs (builtins.map
(name: { inherit name; value = { updateMicrocode = true; }; })
inputs.config.nixos.kernel.cpu);
}
# patches
{
boot.kernelPatches =