{ host, inputs, pkgs, config, self, username, ... }:

{
	imports = [
		./../../modules/sys 
		./hardware.nix
	];

	system.stateVersion = "24.05"; 
	nixpkgs.config.allowUnfree = true;
	nix = {
		settings = {
			auto-optimise-store = true;
			experimental-features = [ "nix-command" "flakes" ];
			substituters = [ "https://nix-gaming.cachix.org" ];
		};
		gc = {
			automatic = true;
			dates = "weekly";
			options = "--delete-older-than 7d";
		};
	};

	environment = {
		variables = {
			XCURSOR_SIZE = "24";
			PATH = "${pkgs.clang-tools}/bin:$PATH";
		};
		shells = with pkgs; [
			zsh
			bash
		];
		systemPackages = with pkgs; [
			acpi
			brightnessctl
			cpupower-gui
			powertop
		];
	};

	time.timeZone = "America/New_York";
	i18n.defaultLocale = "en_US.UTF-8";

	services = {    
		power-profiles-daemon.enable = true;

		upower = {
			enable = true;
			percentageLow = 20;
			percentageCritical = 5;
			percentageAction = 3;
			criticalPowerAction = "PowerOff";
		};

		tlp.settings = {
			CPU_ENERGY_PERF_POLICY_ON_AC = "power";
			CPU_ENERGY_PERF_POLICY_ON_BAT = "power";

			CPU_BOOST_ON_AC = 1;
			CPU_BOOST_ON_BAT = 1;

			CPU_HWP_DYN_BOOST_ON_AC = 1;
			CPU_HWP_DYN_BOOST_ON_BAT = 1;

			PLATFORM_PROFILE_ON_AC = "performance";
			PLATFORM_PROFILE_ON_BAT = "performance";

			INTEL_GPU_MIN_FREQ_ON_AC=500;
			INTEL_GPU_MIN_FREQ_ON_BAT=500;
			# INTEL_GPU_MAX_FREQ_ON_AC=0;
			# INTEL_GPU_MAX_FREQ_ON_BAT=0;
			# INTEL_GPU_BOOST_FREQ_ON_AC=0;
			# INTEL_GPU_BOOST_FREQ_ON_BAT=0;

			PCIE_ASPM_ON_AC = "default";
			PCIE_ASPM_ON_BAT = "powersupersave";
		};
	};

	powerManagement.cpuFreqGovernor = "performance";

	boot = {
		kernelModules = ["acpi_call"];
		extraModulePackages = with config.boot.kernelPackages;
		[
			acpi_call
			cpupower
		]
		++ [pkgs.cpupower-gui];
	};
}
