{ config, ... }:

{
  imports = [
    ./generated.nix # Include the results of the hardware scan.
    ./nfs.nix
  ];

  # Add support of usb
  boot.initrd.availableKernelModules = [ "usb_storage" ];

  # Enable containers
  # See: https://github.com/NixOS/nixpkgs/issues/38676
  boot.kernelModules = [ "veth" ];

  # rtl88x2bu doesn't work on stable at the moment 🤔
  local.system.kernel = "lts";
  boot.extraModulePackages = with config.boot.kernelPackages; [
    rtl88x2bu # wifi
  ];

  networking = {
    useDHCP = false;
    interfaces = {
      wlp4s0.useDHCP = true;
      # wlp11s0f3u2.useDHCP = true;
    };
  };

  # extra configs
  hardware.bluetooth.enable = true;

  hardware.graphics = {
    enable = true;
    enable32Bit = true;
  };

  # All monitors in the right order
  # Source: https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/x11/xserver.nix#L83
  #
  # To see references use the following command
  # man xorg.conf
  services.xserver.xrandrHeads = [
    {
      output = "DP-3";
      monitorConfig = ''
        Option "PreferredMode" "1920x1080"
        # Option "Rotate" "right"
        Option "Position" "0 361"
      '';
    }
    {
      output = "DP-1";
      primary = true;
      monitorConfig = ''
        Option "PreferredMode" "2560x1440"
        Option "Position" "1920 0"
      '';
    }
  ];

  services.logind.extraConfig = ''
    # don’t shutdown when power button is short-pressed
    HandlePowerKey=ignore
  '';
}