dotfiles/hosts/Common/nvidia.nix

45 lines
1.1 KiB
Nix
Raw Normal View History

2024-06-10 16:09:54 +02:00
{ pkgs, config, ... }:
{
2024-06-13 11:53:29 +02:00
services.xserver.videoDrivers = [ "nvidia" ];
environment.systemPackages = with pkgs; [
# Cuda
pciutils
file
gnumake
gcc
cudatoolkit
];
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;
};
2024-06-10 16:09:54 +02:00
};
2024-06-13 11:53:29 +02:00
};
systemd.services.nvidia-control-devices = {
wantedBy = [ "multi-user.target" ];
serviceConfig.ExecStart = "${pkgs.linuxPackages.nvidia_x11.bin}/bin/nvidia-smi";
};
2024-06-10 16:09:54 +02:00
2024-06-13 11:53:29 +02:00
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;
};
2024-06-10 16:09:54 +02:00
};
2024-06-13 11:53:29 +02:00
};
2024-06-10 16:09:54 +02:00
}