{ pkgs, lib, ... }:

let
  inherit (lib) mkDefault;
in
{
  imports = [
    ./desktop.nix
    ../bluetooth
  ];

  services.tlp = {
    enable = mkDefault true;
    settings = {
      CPU_SCALING_GOVERNOR_ON_AC = mkDefault "performance";
      CPU_SCALING_GOVERNOR_ON_BAT = mkDefault "powersave";

      CPU_ENERGY_PERF_POLICY_ON_BAT = mkDefault "power";
      CPU_ENERGY_PERF_POLICY_ON_AC = mkDefault "performance";

      PLATFORM_PROFILE_ON_AC = mkDefault "performance";
      PLATFORM_PROFILE_ON_BAT = mkDefault "low-power";

      START_CHARGE_THRESH_BAT0 = mkDefault 75;
      STOP_CHARGE_THRESH_BAT0 = mkDefault 80;
    };
  };

  # avoid conflicts with tlp
  services.power-profiles-daemon.enable = mkDefault false;

  environment.systemPackages = [ pkgs.powertop ];
}
