home

My NixOS systems configurations.
Log | Files | Refs | LICENSE

commit a511980bf9044898f9b7644f60d057f50e26aa8c
parent 0b2136d6f8acbf0e7afaedba0730375c2628af0c
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Fri, 19 Aug 2022 10:05:12 +0000

systems/modules: modules.hardware.laptop takes over

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Msystems/modules/hardware/laptop.nix | 25++++++++++++++++++++++++-
Msystems/modules/profiles/laptop.nix | 21+++------------------
2 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/systems/modules/hardware/laptop.nix b/systems/modules/hardware/laptop.nix @@ -9,5 +9,28 @@ in enable = mkEnableOption "Enable laptop profile"; }; }; - config = mkIf cfg.enable { }; + config = mkIf cfg.enable { + # Some systctl options for all laptops + boot.kernel.sysctl = { + "vm.swappiness" = 10; + "vm.dirty_ratio" = 25; + "vm.dirty_background_ratio" = 10; + "vm.dirty_writeback_centisecs" = 5000; + "vm.dirty_expire_centisecs" = 5000; + }; + # Packages that are always useful for laptops + environment.systemPackages = with pkgs; [ + lm_sensors + powertop + acpi + ]; + # Run nix-gc only when on AC power + systemd.services.nix-gc.unitConfig.ConditionACPower = true; + # When a laptop is docked, ignor the lid state (if the laptop is opened or closed) + services = { + logind.extraConfig = '' + HandleLidSwitchDocked=ignore + ''; + }; + }; } diff --git a/systems/modules/profiles/laptop.nix b/systems/modules/profiles/laptop.nix @@ -11,23 +11,8 @@ in }; }; config = mkIf cfg.enable { - boot.kernel.sysctl = { - "vm.swappiness" = 10; - "vm.dirty_ratio" = 25; - "vm.dirty_background_ratio" = 10; - "vm.dirty_writeback_centisecs" = 5000; - "vm.dirty_expire_centisecs" = 5000; - }; - environment.systemPackages = with pkgs; [ - lm_sensors - powertop - acpi - ]; - systemd.services.nix-gc.unitConfig.ConditionACPower = true; - services = { - logind.extraConfig = '' - HandleLidSwitchDocked=ignore - ''; - }; + warnings = [ "The option 'profiles.laptop' is deprecated, use modules.hardware.laptop instead" ]; + # Use modules.hardware.enable instead + modules.hardware.laptop.enable = true; }; }