mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-03-25 19:01:43 +01:00
fix: hyprland with nvidia
This commit is contained in:
@@ -14,12 +14,13 @@ in {
|
||||
wayland.windowManager.hyprland.settings.env = [
|
||||
# for hyprland with nvidia gpu, ref https://wiki.hyprland.org/Nvidia/
|
||||
"LIBVA_DRIVER_NAME,nvidia"
|
||||
"XDG_SESSION_TYPE,wayland"
|
||||
"GBM_BACKEND,nvidia-drm"
|
||||
"AQ_DRM_DEVICES,/dev/dri/card1"
|
||||
"__GLX_VENDOR_LIBRARY_NAME,nvidia"
|
||||
# fix https://github.com/hyprwm/Hyprland/issues/1520
|
||||
"WLR_NO_HARDWARE_CURSORS,1"
|
||||
# enable native Wayland support for most Electron apps
|
||||
"ELECTRON_OZONE_PLATFORM_HINT,auto"
|
||||
# VA-API hardware video acceleration
|
||||
"NVD_BACKEND,direct"
|
||||
|
||||
"GBM_BACKEND,nvidia-drm"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ in {
|
||||
"QT_QPA_PLATFORM,wayland"
|
||||
"SDL_VIDEODRIVER,wayland"
|
||||
"GDK_BACKEND,wayland"
|
||||
"XDG_SESSION_TYPE,wayland"
|
||||
];
|
||||
};
|
||||
# gammastep/wallpaper-switcher need this to be enabled.
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
boot.loader.efi.efiSysMountPoint = "/boot";
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
||||
# boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
# boot.kernelPackages = pkgs.linuxPackages_xanmod_latest;
|
||||
|
||||
boot.initrd.availableKernelModules = ["xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod"];
|
||||
boot.initrd.kernelModules = [];
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
{pkgs-unstable, ...}: {
|
||||
{config, ...}: {
|
||||
# ===============================================================================================
|
||||
# for Nvidia GPU
|
||||
# https://wiki.nixos.org/wiki/NVIDIA
|
||||
# https://wiki.hyprland.org/Nvidia/
|
||||
# ===============================================================================================
|
||||
|
||||
# https://wiki.hyprland.org/Nvidia/
|
||||
boot.kernelParams = [
|
||||
"nvidia.NVreg_PreserveVideoMemoryAllocations=1"
|
||||
# Since NVIDIA does not load kernel mode setting by default,
|
||||
# enabling it is required to make Wayland compositors function properly.
|
||||
"nvidia-drm.fbdev=1"
|
||||
];
|
||||
services.xserver.videoDrivers = ["nvidia"]; # will install nvidia-vaapi-driver by default
|
||||
hardware.nvidia = {
|
||||
open = false;
|
||||
# Open-source kernel modules are preferred over and planned to steadily replace proprietary modules
|
||||
open = true;
|
||||
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||
# https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/os-specific/linux/nvidia-x11/default.nix
|
||||
# package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
|
||||
# required by most wayland compositors!
|
||||
modesetting.enable = true;
|
||||
@@ -28,18 +29,9 @@
|
||||
# needed by nvidia-docker
|
||||
enable32Bit = true;
|
||||
};
|
||||
# disable cudasupport before this issue get fixed:
|
||||
# https://github.com/NixOS/nixpkgs/issues/338315
|
||||
nixpkgs.config.cudaSupport = false;
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(_: super: {
|
||||
blender = super.blender.override {
|
||||
# https://nixos.org/manual/nixpkgs/unstable/#opt-cudaSupport
|
||||
cudaSupport = true;
|
||||
waylandSupport = true;
|
||||
};
|
||||
|
||||
# ffmpeg-full = super.ffmpeg-full.override {
|
||||
# withNvcodec = true;
|
||||
# };
|
||||
|
||||
Reference in New Issue
Block a user