{ pkgs, config, ... }:
{
  services.xserver.videoDrivers = [ "nvidia" ];
  environment.systemPackages = with pkgs; [
    pciutils
    file
    gnumake
    gcc
    cudatoolkit
    nvidia-podman
    nvidia-container-toolkit
  ];
  nixpkgs.config.cudaSupport = true;
  hardware.nvidia-container-toolkit.enable = true;
  hardware.nvidia = {
    package = config.boot.kernelPackages.nvidiaPackages.stable;
    modesetting.enable = true;
    powerManagement.enable = false;
    powerManagement.finegrained = true;
    open = false;
    nvidiaSettings = true;
    prime = {
      intelBusId = "PCI:0:2:0";
      nvidiaBusId = "PCI:1:0:0";
      offload = {
        enable = true;
        enableOffloadCmd = true;
      };
    };
  };
  systemd.services.nvidia-control-devices = {
    wantedBy = [ "multi-user.target" ];
    serviceConfig.ExecStart = "${pkgs.linuxPackages.nvidia_x11.bin}/bin/nvidia-smi";
  };

  specialisation = {
    docked.configuration = {
      system.nixos.tags = [ "docked" ];
      hardware.nvidia = {
        powerManagement.finegrained = pkgs.lib.mkForce false;
        prime.offload.enable = pkgs.lib.mkForce false;
        prime.offload.enableOffloadCmd = pkgs.lib.mkForce false;
        prime.sync.enable = pkgs.lib.mkForce true;
      };
    };
  };
}
