Move nvidia to a module

This commit is contained in:
marc committed 2022-11-19 15:42:26 +01:00
1 parent 890b05d352
commit 40d468b433
5 files changed
+49 -33

No files matched your search

-1
View File
@@ -29,7 +29,6 @@
desktop = {
enable = true;
laptop = true;
};
# - Editors and development ------------------
+5 -2
View File
@@ -3,7 +3,6 @@
{
imports = [
./hardware.nix
./nvidia.nix
];
# - Basic --------------------------------------
@@ -24,12 +23,16 @@
# - System -----------------------------------
system.bluetooth.enable = true;
system.nvidia = {
enable = true;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
# - Desktop ----------------------------------
desktop = {
enable = true;
laptop = true;
};
# - Editors and development ------------------
-29
View File
@@ -1,29 +0,0 @@
{ 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
{
environment.systemPackages = [ nvidia-offload ];
services.xserver.videoDrivers = [ "nvidia" ];
hardware.opengl.enable = true;
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;
hardware.nvidia.prime = {
offload.enable = true;
# Bus ID of the Intel GPU. You can find it using lspci, either under 3D or VGA
intelBusId = "PCI:0:2:0";
# Bus ID of the NVIDIA GPU. You can find it using lspci, either under 3D or VGA
nvidiaBusId = "PCI:1:0:0";
};
}