mirror of
https://gitlab.com/Zaney/zaneyos.git
synced 2025-06-21 12:32:51 +02:00
Add & Improve GPU profiles as well as hybrid ones
This commit is contained in:
parent
43df512b8f
commit
3ed2a159a5
@ -17,5 +17,6 @@
|
|||||||
inherit username; inherit wallpaperGit; })
|
inherit username; inherit wallpaperGit; })
|
||||||
(import ./../scripts/themechange.nix { inherit pkgs; inherit flakeDir; })
|
(import ./../scripts/themechange.nix { inherit pkgs; inherit flakeDir; })
|
||||||
(import ./../scripts/theme-selector.nix { inherit pkgs; })
|
(import ./../scripts/theme-selector.nix { inherit pkgs; })
|
||||||
|
(import ./../scripts/nvidia-offload.nix { inherit pkgs; })
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
9
config/scripts/nvidia-offload.nix
Normal file
9
config/scripts/nvidia-offload.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ pkgs }:
|
||||||
|
|
||||||
|
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 "$@"
|
||||||
|
''
|
@ -7,6 +7,8 @@
|
|||||||
./boot.nix
|
./boot.nix
|
||||||
./displaymanager.nix
|
./displaymanager.nix
|
||||||
./intel-gpu.nix
|
./intel-gpu.nix
|
||||||
|
./intel-nvidia.nix
|
||||||
|
./nvidia.nix
|
||||||
./packages.nix
|
./packages.nix
|
||||||
./polkit.nix
|
./polkit.nix
|
||||||
./services.nix
|
./services.nix
|
||||||
|
52
config/system/intel-nvidia.nix
Normal file
52
config/system/intel-nvidia.nix
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
{ pkgs, config, lib, gpuType,
|
||||||
|
intel-bus-id, nvidia-bus-id, ... }:
|
||||||
|
|
||||||
|
lib.mkIf ("${gpuType}" == "intel-nvidia") {
|
||||||
|
nixpkgs.config.packageOverrides =
|
||||||
|
pkgs: {
|
||||||
|
vaapiIntel = pkgs.vaapiIntel.override {
|
||||||
|
enableHybridCodec = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
# OpenGL
|
||||||
|
hardware.opengl = {
|
||||||
|
extraPackages = with pkgs; [
|
||||||
|
intel-media-driver
|
||||||
|
vaapiIntel
|
||||||
|
vaapiVdpau
|
||||||
|
libvdpau-va-gl
|
||||||
|
];
|
||||||
|
};
|
||||||
|
services.xserver.videoDrivers = ["nvidia"];
|
||||||
|
hardware.nvidia = {
|
||||||
|
# Modesetting is required.
|
||||||
|
modesetting.enable = true;
|
||||||
|
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||||
|
powerManagement.enable = false;
|
||||||
|
# Fine-grained power management. Turns off GPU when not in use.
|
||||||
|
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||||
|
powerManagement.finegrained = false;
|
||||||
|
# Use the NVidia open source kernel module (not to be confused with the
|
||||||
|
# independent third-party "nouveau" open source driver).
|
||||||
|
# Support is limited to the Turing and later architectures. Full list of
|
||||||
|
# supported GPUs is at:
|
||||||
|
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
|
||||||
|
# Only available from driver 515.43.04+
|
||||||
|
# Currently alpha-quality/buggy, so false is currently the recommended setting.
|
||||||
|
open = false;
|
||||||
|
# Enable the Nvidia settings menu,
|
||||||
|
# accessible via `nvidia-settings`.
|
||||||
|
nvidiaSettings = true;
|
||||||
|
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
prime = {
|
||||||
|
offload = {
|
||||||
|
enable = true;
|
||||||
|
enableOffloadCmd = true;
|
||||||
|
};
|
||||||
|
# Make sure to use the correct Bus ID values for your system!
|
||||||
|
intelBusId = "${intel-bus-id}";
|
||||||
|
nvidiaBusId = "${nvidia-bus-id}";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
27
config/system/nvidia.nix
Normal file
27
config/system/nvidia.nix
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{ pkgs, config, lib, gpuType, ... }:
|
||||||
|
|
||||||
|
lib.mkIf ("${gpuType}" == "nvidia") {
|
||||||
|
services.xserver.videoDrivers = ["nvidia"];
|
||||||
|
hardware.nvidia = {
|
||||||
|
# Modesetting is required.
|
||||||
|
modesetting.enable = true;
|
||||||
|
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||||
|
powerManagement.enable = false;
|
||||||
|
# Fine-grained power management. Turns off GPU when not in use.
|
||||||
|
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||||
|
powerManagement.finegrained = false;
|
||||||
|
# Use the NVidia open source kernel module (not to be confused with the
|
||||||
|
# independent third-party "nouveau" open source driver).
|
||||||
|
# Support is limited to the Turing and later architectures. Full list of
|
||||||
|
# supported GPUs is at:
|
||||||
|
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
|
||||||
|
# Only available from driver 515.43.04+
|
||||||
|
# Currently alpha-quality/buggy, so false is currently the recommended setting.
|
||||||
|
open = false;
|
||||||
|
# Enable the Nvidia settings menu,
|
||||||
|
# accessible via `nvidia-settings`.
|
||||||
|
nvidiaSettings = true;
|
||||||
|
# Optionally, you may need to select the appropriate driver version for your specific GPU.
|
||||||
|
package = config.boot.kernelPackages.nvidiaPackages.stable;
|
||||||
|
};
|
||||||
|
}
|
@ -13,7 +13,7 @@ in {
|
|||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
wget curl git cmatrix lolcat neofetch htop btop libvirt
|
wget curl git cmatrix lolcat neofetch htop btop libvirt
|
||||||
polkit_gnome lm_sensors unzip unrar libnotify eza
|
polkit_gnome lm_sensors unzip unrar libnotify eza
|
||||||
v4l-utils ydotool wl-clipboard socat cowsay lsd
|
v4l-utils ydotool wl-clipboard socat cowsay lsd lshw
|
||||||
pkg-config meson hugo gnumake ninja go nodejs symbola
|
pkg-config meson hugo gnumake ninja go nodejs symbola
|
||||||
noto-fonts-color-emoji material-icons brightnessctl
|
noto-fonts-color-emoji material-icons brightnessctl
|
||||||
toybox virt-viewer jetbrains.pycharm-community-bin
|
toybox virt-viewer jetbrains.pycharm-community-bin
|
||||||
|
@ -34,9 +34,15 @@
|
|||||||
flakeDir = "/home/${username}/zaneyos";
|
flakeDir = "/home/${username}/zaneyos";
|
||||||
# Driver selection profile
|
# Driver selection profile
|
||||||
# Options include amd (tested), intel, nvidia
|
# Options include amd (tested), intel, nvidia
|
||||||
|
# GPU hybrid options: intel-nvidia, amd-nvidia
|
||||||
# vm for both if you are running a vm
|
# vm for both if you are running a vm
|
||||||
cpuType = "amd";
|
cpuType = "amd";
|
||||||
gpuType = "amd";
|
gpuType = "amd";
|
||||||
|
# Run: sudo lshw -c display to find this info
|
||||||
|
# This is needed for hybrid nvidia offloading
|
||||||
|
# Run: nvidia-offload (insert program name)
|
||||||
|
intel-bus-id = "PCI:0:2:0";
|
||||||
|
nvidia-bus-id = "PCI:14:0:0";
|
||||||
|
|
||||||
pkgs = import nixpkgs {
|
pkgs = import nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user