mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-12-21 19:24:15 +00:00
simplify levi video config
This commit is contained in:
parent
4bb0b8777d
commit
913896ec30
1 changed files with 69 additions and 85 deletions
|
@ -1,92 +1,76 @@
|
||||||
{ lib, pkgs, ... }:
|
{
|
||||||
let
|
hardware.nvidia.prime.intelBusId = "PCI:0:2:0";
|
||||||
current-mode = "nvidia-mux";
|
hardware.nvidia.prime.nvidiaBusId = "PCI:1:0:0";
|
||||||
|
|
||||||
constants = {
|
### NVIDIA-only using MUX switch in BIOS.
|
||||||
hardware.nvidia.prime.intelBusId = "PCI:0:2:0";
|
#
|
||||||
hardware.nvidia.prime.nvidiaBusId = "PCI:1:0:0";
|
# good:
|
||||||
};
|
# simple, always works.
|
||||||
|
# max performance everywhere.
|
||||||
|
#
|
||||||
|
# bad:
|
||||||
|
# requires BIOS setting changes, which is annoying.
|
||||||
|
#
|
||||||
|
boot.kernelParams = [ "module_blacklist=i915" ];
|
||||||
|
services.xserver.displayManager.gdm.wayland = false;
|
||||||
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
services.xserver.screenSection = ''
|
||||||
|
Option "metamodes" "DP-2: 2560x1440_165 +0+0 {AllowGSYNCCompatible=On}"
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
||||||
available-modes = {
|
################################################################################
|
||||||
|
|
||||||
nvidia = {
|
### "sync mode"
|
||||||
### "sync mode"
|
#
|
||||||
#
|
# good:
|
||||||
# good:
|
# max performance on external displays
|
||||||
# max performance on external displays
|
# no BIOS settings change needed
|
||||||
# no BIOS settings change needed
|
#
|
||||||
#
|
# bad:
|
||||||
# bad:
|
# graphics performance overhead on internal display
|
||||||
# graphics performance overhead on internal display
|
# internal display capped at 60hz
|
||||||
# internal display capped at 60hz
|
#
|
||||||
#
|
# hardware.nvidia.prime.sync.enable = true;
|
||||||
hardware.nvidia.prime.sync.enable = true;
|
# hardware.nvidia.modesetting.enable = true;
|
||||||
hardware.nvidia.modesetting.enable = true;
|
# services.xserver.displayManager.gdm.wayland = false;
|
||||||
services.xserver.displayManager.gdm.wayland = false;
|
# services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
# # xrandr workaround for laptop panel not showing up with GDM. Reference:
|
||||||
# xrandr workaround for laptop panel not showing up with GDM. Reference:
|
# # https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/hardware/video/nvidia.nix
|
||||||
# https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/hardware/video/nvidia.nix
|
# services.xserver.displayManager.sessionCommands = ''
|
||||||
services.xserver.displayManager.sessionCommands = ''
|
# ${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0
|
||||||
${pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource modesetting NVIDIA-0
|
# '';
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
nvidia-mux = {
|
################################################################################
|
||||||
### optimus disabled in BIOS with MUX switch.
|
|
||||||
#
|
|
||||||
# good:
|
|
||||||
# simple, always works.
|
|
||||||
# max performance everywhere.
|
|
||||||
#
|
|
||||||
# bad:
|
|
||||||
# requires BIOS setting changes, which is annoying.
|
|
||||||
#
|
|
||||||
boot.kernelParams = [ "module_blacklist=i915" ];
|
|
||||||
services.xserver.displayManager.gdm.wayland = false;
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
services.xserver.screenSection = ''
|
|
||||||
Option "metamodes" "DP-2: 2560x1440_165 +0+0 {AllowGSYNCCompatible=On}"
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
intel = {
|
### nvidia drivers disabled
|
||||||
### nvidia drivers disabled
|
#
|
||||||
#
|
# Not well tested. Possibly Incomplete.
|
||||||
# Not well tested. Possibly Incomplete.
|
# Won't allow external displays connected to nvidia GPU.
|
||||||
# Won't allow external displays connected to nvidia GPU.
|
#
|
||||||
#
|
# Shutting off Nvidia GPU would theoretically save power.
|
||||||
# Shutting off Nvidia GPU would theoretically save power.
|
# I do not think this actually powers down the Nvidia GPU, just stops using it.
|
||||||
# I do not think this actually powers down the Nvidia GPU, just stops using it.
|
#
|
||||||
#
|
# boot.kernelParams = [ "module_blacklist=nouveau" ];
|
||||||
boot.kernelParams = [ "module_blacklist=nouveau" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
hybrid = {
|
################################################################################
|
||||||
### hybrid graphics
|
|
||||||
#
|
|
||||||
# Not well tested. Possibly Incomplete.
|
|
||||||
# Won't allow external displays connected to nvidia GPU.
|
|
||||||
#
|
|
||||||
# Everything would use intel by default,
|
|
||||||
# but specific apps would run on the nvidia GPU under the script.
|
|
||||||
#
|
|
||||||
hardware.nvidia.prime.offload.enable = true;
|
|
||||||
services.xserver.videoDrivers = [ "nvidia" ];
|
|
||||||
environment.systemPackages = [
|
|
||||||
(pkgs.writeShellScriptBin "nv" ''
|
|
||||||
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 "$@"
|
|
||||||
'')
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
### hybrid graphics
|
||||||
|
#
|
||||||
in
|
# Not well tested. Possibly Incomplete.
|
||||||
lib.mkMerge [
|
# Won't allow external displays connected to nvidia GPU.
|
||||||
(constants)
|
#
|
||||||
(available-modes.${current-mode})
|
# Everything would use intel by default,
|
||||||
]
|
# but specific apps would run on the nvidia GPU under the script.
|
||||||
|
#
|
||||||
|
# hardware.nvidia.prime.offload.enable = true;
|
||||||
|
# services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
# environment.systemPackages = [
|
||||||
|
# (pkgs.writeShellScriptBin "nv" ''
|
||||||
|
# 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 "$@"
|
||||||
|
# '')
|
||||||
|
# ];
|
||||||
|
|
Loading…
Reference in a new issue