{ config, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
      ../modules/home-manager.nix
      ../modules/common.nix
      ../modules/users.nix
      ../modules/locales.nix
      ../modules/services.nix
      ../modules/programs.nix
      ../modules/gaming.nix
      ../modules/obs-studio.nix
      ../modules/garbage-collection.nix
      ../modules/printing.nix
      ../modules/docker.nix
      ../modules/matrix.nix
      ../modules/kdenlive.nix
      ../modules/audacity.nix
      ../modules/ollama.nix
      ../modules/wireguard.nix
      ../modules/rdp.nix
    ];

  boot.loader.systemd-boot.enable = true;
  boot.loader.efi.canTouchEfiVariables = true;

  networking.hostName = "gandalf";
  networking.networkmanager.enable = true;
  networking.nameservers = [ "192.168.68.56" "1.1.1.1" "8.8.8.8" ];

  networking.interfaces.enp130s0.wakeOnLan.enable = true;
  networking.firewall.allowedUDPPorts = [ 9 ];

  services.xserver.videoDrivers = ["nvidia"];

  hardware = {
    graphics.enable = true;

    nvidia.modesetting.enable = true;
    nvidia.open = true;
    nvidia.nvidiaSettings = true;
  };

  systemd.targets.sleep.enable = false;
  systemd.targets.suspend.enable = false;
  systemd.targets.hibernate.enable = false;
  systemd.targets.hybrid-sleep.enable = false;

  virtualisation.libvirtd.enable = true;

  specialisation = {
    zen.configuration = {
      boot.kernelPackages = pkgs.linuxPackages_zen;
    };
  };

  services = {
    # Bluetooth fixes
    # Can be removed when https://github.com/NixOS/nixpkgs/pull/499670 is merged and in 25.11
    udev.extraRules = ''
      SUBSYSTEM=="usb", ENV{ID_VENDOR_ID}=="0489", ENV{ID_MODEL_ID}=="e111", ENV{UDISKS_IGNORE}="1", ENV{ID_MEDIA_PLAYER}="", ENV{ID_MTP_DEVICE}="", ENV{ID_GPHOTO2}="", ENV{ID_INPUT}="", ENV{SOLID_IGNORE}="1", TAG-="uaccess"

      SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", ATTRS{idProduct}=="e111", ENV{DEVTYPE}=="usb_interface", ENV{UDISKS_IGNORE}="1", ENV{ID_MEDIA_PLAYER}="", ENV{ID_MTP_DEVICE}="", ENV{ID_GPHOTO2}="", ENV{ID_INPUT}="", ENV{SOLID_IGNORE}="1", TAG-="uaccess"

      SUBSYSTEM=="usb", KERNEL=="3-14:*", ENV{UDISKS_IGNORE}="1", ENV{ID_MEDIA_PLAYER}="", ENV{ID_MTP_DEVICE}="", ENV{ID_GPHOTO2}="", ENV{ID_INPUT}="", ENV{SOLID_IGNORE}="1", TAG-="uaccess"

      SUBSYSTEM=="usb", KERNELS=="3-14", ENV{UDISKS_IGNORE}="1", ENV{ID_MEDIA_PLAYER}="", ENV{ID_MTP_DEVICE}="", ENV{ID_GPHOTO2}="", ENV{SOLID_IGNORE}="1"
    '';
  };

  system.stateVersion = "25.11"; # Did you read the comment?
}
