laptop.nix (700B)
1 { config, lib, pkgs, ... }: 2 3 with lib; 4 let 5 cfg = config.profiles.laptop; 6 in 7 { 8 options = { 9 profiles.laptop = { 10 enable = mkEnableOption "Enable laptop profile"; 11 }; 12 }; 13 config = mkIf cfg.enable { 14 boot.kernel.sysctl = { 15 "vm.swappiness" = 10; 16 "vm.dirty_ratio" = 25; 17 "vm.dirty_background_ratio" = 10; 18 "vm.dirty_writeback_centisecs" = 5000; 19 "vm.dirty_expire_centisecs" = 5000; 20 }; 21 environment.systemPackages = with pkgs; [ 22 lm_sensors 23 powertop 24 acpi 25 ]; 26 systemd.services.nix-gc.unitConfig.ConditionACPower = true; 27 services = { 28 logind.extraConfig = '' 29 HandleLidSwitchDocked=ignore 30 ''; 31 }; 32 }; 33 }