From b04b1375d03a91529daaf48ac8598668290b5a6f Mon Sep 17 00:00:00 2001 From: chn Date: Wed, 27 Mar 2024 18:47:56 +0800 Subject: [PATCH] =?UTF-8?q?system.sysctl:=20=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/system/sysctl.nix | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/modules/system/sysctl.nix b/modules/system/sysctl.nix index 9f04f5f8..8c2a9773 100644 --- a/modules/system/sysctl.nix +++ b/modules/system/sysctl.nix @@ -4,21 +4,17 @@ inputs: { laptop-mode = mkOption { type = types.nullOr types.int; default = null; }; }; - config = - let - inherit (inputs.lib) mkIf mkMerge; - inherit (inputs.config.nixos.system) sysctl; - in mkMerge - [ + config = let inherit (inputs.config.nixos.system) sysctl; in inputs.lib.mkMerge + [ + { + boot.kernel.sysctl = { - boot.kernel.sysctl = - { - "vm.oom_kill_allocating_task" = true; - "vm.oom_dump_tasks" = false; - "vm.overcommit_memory" = 1; - "kernel.sysrq" = 438; - }; - } - (mkIf (sysctl.laptop-mode != null) { boot.kernel.sysctl."vm.laptop_mode" = sysctl.laptop-mode; }) - ]; + "vm.oom_kill_allocating_task" = true; + "vm.oom_dump_tasks" = false; + "vm.overcommit_memory" = 1; + "kernel.sysrq" = 438; + }; + } + (inputs.lib.mkIf (sysctl.laptop-mode != null) { boot.kernel.sysctl."vm.laptop_mode" = sysctl.laptop-mode; }) + ]; }