It's moving

This commit is contained in:
Hadi
2026-06-29 17:48:21 +02:00
parent 082de49ca4
commit cdffe66d72
62 changed files with 953 additions and 2147 deletions
+21 -45
View File
@@ -5,67 +5,49 @@
config,
...
}: let
# Using beta driver for recent GPUs like RTX 4070
nvidiaDriverChannel = config.boot.kernelPackages.nvidiaPackages.production;
in {
# Video drivers configuration for Xorg and Wayland
services.xserver.videoDrivers = ["nvidia"]; # Simplified - other modules are loaded automatically
services.xserver.videoDrivers = ["nvidia"];
# Kernel parameters for better Wayland and Hyprland integration
boot.kernelParams = [
"nvidia-drm.modeset=1" # Enable mode setting for Wayland
"nvidia.NVreg_PreserveVideoMemoryAllocations=1" # Improves resume after sleep
];
# Blacklist nouveau to avoid conflicts
boot.blacklistedKernelModules = ["nouveau"];
# Environment variables for better compatibility
environment.variables = {
LIBVA_DRIVER_NAME = "nvidia"; # Hardware video acceleration
GBM_BACKEND = "nvidia-drm"; # Graphics backend for Wayland
__GLX_VENDOR_LIBRARY_NAME = "nvidia"; # Use Nvidia driver for GLX
NIXOS_OZONE_WL = "1"; # Wayland support for Electron apps
__GL_GSYNC_ALLOWED = "1"; # Enable G-Sync if available
__GL_VRR_ALLOWED = "1"; # Enable VRR (Variable Refresh Rate)
NVD_BACKEND = "direct"; # Configuration for new driver
MOZ_ENABLE_WAYLAND = "1"; # Wayland support for Firefox
LIBVA_DRIVER_NAME = "nvidia";
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
NIXOS_OZONE_WL = "1";
__GL_GSYNC_ALLOWED = "1";
__GL_VRR_ALLOWED = "1";
NVD_BACKEND = "direct";
MOZ_ENABLE_WAYLAND = "1";
};
# Configuration for proprietary packages
nixpkgs.config = {
nvidia.acceptLicense = true;
};
nixpkgs.config.nvidia.acceptLicense = true;
# Nvidia configuration
hardware = {
nvidia = {
open = false; # Proprietary driver for better performance
nvidiaSettings = true; # Nvidia settings utility
open = true; # Open kernel modules, recommended for Turing and newer (RTX 4070 = Ada Lovelace)
nvidiaSettings = true;
powerManagement = {
enable = true; # Power management
finegrained = true; # More precise power consumption control
enable = true;
finegrained = true;
};
modesetting.enable = true; # Required for Wayland
modesetting.enable = true;
package = nvidiaDriverChannel;
forceFullCompositionPipeline = true; # Prevents screen tearing
# forceFullCompositionPipeline = true; # Only useful when display is connected directly to Nvidia GPU, not in PRIME offload mode
# Configuration for hybrid AMD+Nvidia laptop
prime = {
# Optimized configuration for switchable graphics laptops
offload = {
enable = true; # Mode optimized for power saving
enableOffloadCmd = true; # Allows running applications with dedicated GPU
enable = true;
enableOffloadCmd = true;
};
# sync.enable disabled as offload is generally better for laptops
sync.enable = false;
# PCI IDs verified for your hardware
amdgpuBusId = "PCI:5:0:0"; # Integrated AMD GPU
nvidiaBusId = "PCI:1:0:0"; # Dedicated Nvidia GPU
sync.enable = false; # offload mode is better for battery life
amdgpuBusId = "PCI:5:0:0";
nvidiaBusId = "PCI:1:0:0";
};
};
# Enhanced graphics support
graphics = {
enable = true;
enable32Bit = true;
@@ -73,10 +55,8 @@ in {
nvidia-vaapi-driver
libva-vdpau-driver
libvdpau-va-gl
mesa
egl-wayland
vulkan-loader
vulkan-validation-layers
libva
];
};
@@ -90,13 +70,9 @@ in {
];
};
# Additional useful packages
environment.systemPackages = with pkgs; [
vulkan-tools
mesa-demos
libva-utils # VA-API debugging tools
libva-utils
];
# Enable Nvidia container toolkit for GPU acceleration in containers (docker)
hardware.nvidia-container-toolkit.enable = false;
}