main
 1{ pkgs, ... }:
 2{
 3  # Some systctl options for all laptops
 4  boot.kernel.sysctl = {
 5    "kernel.nmi_watchdog" = 0;
 6    "vm.swappiness" = 10;
 7    "vm.dirty_ratio" = 25;
 8    "vm.dirty_background_ratio" = 10;
 9    "vm.dirty_writeback_centisecs" = 6000;
10    "vm.dirty_expire_centisecs" = 6000;
11  };
12
13  environment.systemPackages = with pkgs; [
14    acpi
15    powertop
16  ];
17
18  # Run nix-gc only when on AC power
19  systemd.services.nix-gc.unitConfig.ConditionACPower = true;
20
21  services = {
22    # When a laptop is docked or on external power, ignore the lid state (if the laptop is opened or closed)
23    logind.settings.Login = {
24      HandleLidSwitchExternalPower = "ignore";
25      HandleLidSwitchDocked = "ignore";
26    };
27    power-profiles-daemon.enable = true;
28  };
29
30}