{ pkgs, lib, config, ... }:
{
hardware.cpu.intel.updateMicrocode = true;
nix = {
  # Too CPU hungry for the DL10J, for too little Mio saved
  autoOptimiseStore = false;
  maxJobs = 2;
};
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";

boot.kernel = {
  sysctl = {
    # Recommended to improve performance when RAM is sufficient.
    "vm.swappiness" = lib.mkDefault 10;
  };
};

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

boot.initrd = {
  availableKernelModules = [
    "ahci"
    "ehci_pci" # useless ?
    "i2c_i801" # SMBus
    "mei_me" # Communication controller
    "nvme" # NVME M.2 disk
    #"rtl8188ee" # Wireless
    "rtsx_usb_sdmmc" # SD card
    #"snd_hda_intel" # Audio
    "uas" # USB storage
    "xhci_hcd" # USB
    #"i915" # VGA
    "igb" # Ethernet
    # Made the AES modules available at initrd,
    # to speedup the deciphering of the root.
    "aes_x86_64"
    "aesni_intel"
    "cryptd"
  ];
  kernelModules = [
    "igb" # Ethernet
    "nvme" # NVME M.2 disk
    "rtsx_usb_sdmmc" # SD card
  ];
};
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
boot.kernelParams = [
  "gfxpayload=text"
  "console=ttyS0,115200n8"
  "console=ttyS1,115200n8"
  "console=tty0"
  # Use arc_summary to print stats
  "zfs.zfs_arc_max=${toString (1000 * 1024 * 1024)}" # bytes
];

environment.systemPackages = with pkgs; [
  pciutils
  #flashrom
  nvme-cli
];
}