{ pkgs, lib, config, ... }:
with lib;
{
  imports = [
    ../acpid.nix
    ../acpi_call.nix
    ../tlp.nix
  ];

  nixpkgs.hostPlatform = {
    system = "x86_64-linux";
    config = "x86_64-unknown-linux-gnu";
  };

  boot.kernelModules = [
    "kvm_intel"
  ];
  boot.extraModulePackages = [
  ];
  boot.kernelParams = [
  ];
  boot.initrd.kernelModules = [
    "aesni_intel"
    "crypto_simd"
    "e1000e" # Ethernet
    "i915"
    "nvme" # NVME M.2 disk
    "uas" # USB storage
    "xhci_hcd"
  ];
  boot.initrd.availableKernelModules = [
  ];

  environment.systemPackages = [
    pkgs.fwupd
  ];
  environment.variables = {
    VDPAU_DRIVER = mkIf config.hardware.opengl.enable (mkDefault "va_gl");
  };

  hardware.cpu.intel.updateMicrocode = mkDefault config.hardware.enableRedistributableFirmware;
  hardware.opengl.extraPackages = [
    pkgs.intel-media-driver # LIBVA_DRIVER_NAME=iHD
    # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
    (if (versionOlder (versions.majorMinor version) "23.11") then pkgs.vaapiIntel else pkgs.intel-vaapi-driver)
    pkgs.libvdpau-va-gl
    pkgs.vaapiVdpau
  ];
  hardware.trackpoint.enable = mkDefault true;
  hardware.trackpoint.emulateWheel = mkDefault config.hardware.trackpoint.enable;

  services.fwupd.enable = true;
  services.upower.enable = true;
  services.xserver.libinput.enable = mkDefault true;
}