mirror of
https://github.com/aviallon/nixos-lib.git
synced 2026-04-06 01:38:06 +00:00
[Hardware/Nvidia] Cleanup and fix some bugs
Fix suspend and add new environment variables.
This commit is contained in:
parent
91b49073f2
commit
844b0be2df
1 changed files with 76 additions and 47 deletions
|
|
@ -2,7 +2,28 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.aviallon.hardware.nvidia;
|
cfg = config.aviallon.hardware.nvidia;
|
||||||
|
generalCfg = config.aviallon.general;
|
||||||
|
toValue = x: if x then "1" else "0";
|
||||||
in {
|
in {
|
||||||
|
options = {
|
||||||
|
aviallon.hardware.nvidia.proprietary = {
|
||||||
|
#enable = mkEnableOption "Wether to user NVidia proprietary drivers";
|
||||||
|
gsync = mkEnableOption "Screen is GSYNC monitor";
|
||||||
|
vsync = mkOption {
|
||||||
|
description = "Wether to enable or disable vsync";
|
||||||
|
default = true;
|
||||||
|
example = false;
|
||||||
|
type = types.bool;
|
||||||
|
};
|
||||||
|
coolbits = mkOption {
|
||||||
|
description = "Coolbits value. Used for enabling hidden (dangerous) features";
|
||||||
|
default = if generalCfg.unsafeOptimizations then 28 else 5;
|
||||||
|
example = 28;
|
||||||
|
type = types.int;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config = mkIf (cfg.enable && cfg.useProprietary) {
|
config = mkIf (cfg.enable && cfg.useProprietary) {
|
||||||
boot.initrd.kernelModules = [
|
boot.initrd.kernelModules = [
|
||||||
"nvidia"
|
"nvidia"
|
||||||
|
|
@ -15,6 +36,11 @@ in {
|
||||||
"nvidia"
|
"nvidia"
|
||||||
];
|
];
|
||||||
|
|
||||||
|
services.xserver.screenSection = ''
|
||||||
|
Option "Coolbits" "${toString cfg.proprietary.coolbits}"
|
||||||
|
Option "InbandStereoSignaling" "true"
|
||||||
|
'';
|
||||||
|
|
||||||
services.xserver.exportConfiguration = true;
|
services.xserver.exportConfiguration = true;
|
||||||
|
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
|
|
@ -31,8 +57,9 @@ in {
|
||||||
}
|
}
|
||||||
// optionalAttrs cfg.saveAllVram {
|
// optionalAttrs cfg.saveAllVram {
|
||||||
"nvidia.NVreg_PreserveVideoMemoryAllocations" = 1;
|
"nvidia.NVreg_PreserveVideoMemoryAllocations" = 1;
|
||||||
"nvidia.NVreg_TemporaryFilePath" = "/tmp/nvidia-gpu.vram.img";
|
"nvidia.NVreg_TemporaryFilePath" = "/var/tmp/nvidia-gpu.vram.img";
|
||||||
};
|
}
|
||||||
|
;
|
||||||
|
|
||||||
aviallon.programs.allowUnfreeList = [
|
aviallon.programs.allowUnfreeList = [
|
||||||
"nvidia-x11"
|
"nvidia-x11"
|
||||||
|
|
@ -61,6 +88,8 @@ in {
|
||||||
"__GL_YIELD" = "USLEEP"; # use usleep(0) instead of sched_yield() -> better performance in most cases
|
"__GL_YIELD" = "USLEEP"; # use usleep(0) instead of sched_yield() -> better performance in most cases
|
||||||
"__GL_ALLOW_UNOFFICIAL_PROTOCOL" = "1"; # allow unofficial GLX protocol if also set in Xorg conf
|
"__GL_ALLOW_UNOFFICIAL_PROTOCOL" = "1"; # allow unofficial GLX protocol if also set in Xorg conf
|
||||||
"__GL_VRR_ALLOWED" = "1"; # Try to enable G-SYNC VRR if screen AND app is compatible
|
"__GL_VRR_ALLOWED" = "1"; # Try to enable G-SYNC VRR if screen AND app is compatible
|
||||||
|
"__GL_SYNC_TO_VBLANK" = toValue cfg.proprietary.vsync;
|
||||||
|
"__GL_THREADED_OPTIMIZATIONS" = toValue generalCfg.unsafeOptimizations;
|
||||||
"KWIN_DRM_USE_EGL_STREAMS" = "1"; # Make KWin use EGL Streams, because otherwise performance will be horrible.
|
"KWIN_DRM_USE_EGL_STREAMS" = "1"; # Make KWin use EGL Streams, because otherwise performance will be horrible.
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue