Skip to content

Commit

Permalink
Update config removing deprecated options
Browse files Browse the repository at this point in the history
  • Loading branch information
foofrog committed Jun 23, 2024
1 parent bb26300 commit c67c6b7
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/foundations/graphics/amd.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
config,
lib,
...
}: {
boot.kernelModules = ["kvm-amd"];
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}
11 changes: 11 additions & 0 deletions modules/foundations/graphics/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{...}: {
imports = [
./amd.nix
./nvidia.nix
];

hardware.graphics = {
enable = true;
enable32Bit = true;
};
}
50 changes: 50 additions & 0 deletions modules/foundations/graphics/nvidia.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
config,
pkgs,
...
}: {
# Load Nvidia driver (works for both X and Wayland)
services.xserver.videoDrivers = ["nvidia"];

boot = {
kernelModules = ["nvidia" "nvidia_modeset" "nvidia_uvm" "nvidia_drm" "i2c-nvidia_gpu"];
blacklistedKernelModules = ["nouveau"];
};

hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.latest;
modesetting.enable = true;

powerManagement = {
# NOTE: Currently experimental
enable = false;
finegrained = false;
};

nvidiaSettings = true; # NOTE: It enables the `nvidia-settings` command
open = false;
nvidiaPersistenced = true;

# Enable NVIDIA Optimus (Offload)
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};

amdgpuBusId = "PCI:5:0:0"; # Integrated
nvidiaBusId = "PCI:1:0:0"; # Dedicated
};
};

environment.sessionVariables = {
LIBVA_DRIVER_NAME = "nvidia";
VDPAU_DRIVER = "va_gl";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
};

hardware.graphics.extraPackages = with pkgs; [
vaapiVdpau
nvidia-vaapi-driver
];
}

0 comments on commit c67c6b7

Please sign in to comment.