NVidia setup

This commit is contained in:
Trevor Vallender 2023-02-06 09:21:35 +00:00
parent ea3c9c3be1
commit 3bd899bc13
1 changed files with 24 additions and 1 deletions

View File

@ -1,5 +1,14 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
let
nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
exec "$@"
'';
in
{ {
imports = imports =
[ [
@ -11,7 +20,7 @@
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "thompson"; networking.hostName = "thompson";
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default. networking.networkmanager.enable = true;
time.timeZone = "Europe/London"; time.timeZone = "Europe/London";
@ -36,12 +45,26 @@
services.xserver.enable = true; services.xserver.enable = true;
services.xserver.displayManager.sddm.enable = true; services.xserver.displayManager.sddm.enable = true;
services.xserver.desktopManager.plasma5.enable = true; services.xserver.desktopManager.plasma5.enable = true;
hardware.nvidia.modesetting.enable = true;
services.xserver.videoDrivers = ["nvidia" ];
hardware.opengl.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
hardware.nvidia.prime = {
sync.enable = true;
nvidiaBusId = "PCI:1:0:0";
intelBusId = "PCI:0:2:0";
};
hardware.bluetooth.enable = true;
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
neovim neovim
wget wget
tmux tmux
git git
pciutils
nvidia-offload
]; ];
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;