{ pkgs, lib, config, ... }:
{
hardware.cpu.amd.updateMicrocode = true;

# Too CPU hungry for this hardware, for too little Mio saved
nix.settings.auto-optimise-store = false;

powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";

# https://insanity.industries/post/sata-power-consumption/
services.udev.extraRules = ''
  SUBSYSTEM=="scsi_host", KERNEL=="host*", ATTR{link_power_management_policy}="med_power_with_dipm"
'';

boot.loader = {
  grub = {
    enable = true;
    version = 2;
    copyKernels = true;
    configurationLimit = lib.mkDefault 1;
    # efiSupport = true;
    # In case canTouchEfiVariables doesn't work
    #efiInstallAsRemovable = true;
    devices = [
      # Completed in the importing configuration
    ];
    /*
    mirroredBoots = [
      { devices = [ "${disk_id}" ];
        path    = "/boot${bootnum}";
      }
    ];
    */
  };
  /*
  efi = {
    canTouchEfiVariables = true;
    efiSysMountPoint = "/boot/efi";
  };
  */
};

boot.initrd = {
  availableKernelModules = [
    "ahci"
    "ehci_pci"
    "sd_mod"
    "sg"
    "uas"
  ];
  kernelModules = [
    # Ethernet driver
    "igb"
    # Enable to switch to stage-2 from the SD card
    "sdhci_pci"
  ];
};

boot.consoleLogLevel = lib.mkDefault 7;
boot.kernelParams = [
  "gfxpayload=text"
  "console=ttyS0,115200n8"
  # Use arc_summary to print stats
  #"zfs.zfs_arc_max=${toString (500 * 1024 * 1024)}" # bytes
];

environment.systemPackages = [
  pkgs.flashrom
  pkgs.pciutils
];
}