mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-18 03:30:45 +00:00
nixos/nvidia: add Dynamic Boost support
This commit is contained in:
parent
a5ccd2c5c8
commit
4ca2a16390
|
@ -31,6 +31,12 @@ in {
|
|||
the NVIDIA docs, on Chapter 22. PCI-Express Runtime D3 (RTD3) Power Management.
|
||||
'');
|
||||
|
||||
dynamicBoost.enable = lib.mkEnableOption (lib.mdDoc ''
|
||||
dynamic Boost balances power between the CPU and the GPU for improved
|
||||
performance on supported laptops using the nvidia-powerd daemon. For more
|
||||
information, see the NVIDIA docs, on Chapter 23. Dynamic Boost on Linux.
|
||||
'');
|
||||
|
||||
modesetting.enable = lib.mkEnableOption (lib.mdDoc ''
|
||||
kernel modesetting when using the NVIDIA proprietary driver.
|
||||
|
||||
|
@ -238,6 +244,11 @@ in {
|
|||
assertion = cfg.open -> (cfg.package ? open && cfg.package ? firmware);
|
||||
message = "This version of NVIDIA driver does not provide a corresponding opensource kernel driver";
|
||||
}
|
||||
|
||||
{
|
||||
assertion = cfg.dynamicBoost.enable -> lib.versionAtLeast nvidia_x11.version "510.39.01";
|
||||
message = "NVIDIA's Dynamic Boost feature only exists on versions >= 510.39.01";
|
||||
}
|
||||
];
|
||||
|
||||
# If Optimus/PRIME is enabled, we:
|
||||
|
@ -394,10 +405,26 @@ in {
|
|||
};
|
||||
};
|
||||
})
|
||||
(lib.mkIf cfg.dynamicBoost.enable {
|
||||
"nvidia-powerd" = {
|
||||
description = "nvidia-powerd service";
|
||||
path = [
|
||||
pkgs.util-linux # nvidia-powerd wants lscpu
|
||||
];
|
||||
wantedBy = ["multi-user.target"];
|
||||
serviceConfig = {
|
||||
Type = "dbus";
|
||||
BusName = "nvidia.powerd.server";
|
||||
ExecStart = "${nvidia_x11.bin}/bin/nvidia-powerd";
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
|
||||
services.acpid.enable = true;
|
||||
|
||||
services.dbus.packages = lib.optional cfg.dynamicBoost.enable nvidia_x11.bin;
|
||||
|
||||
hardware.firmware = lib.optional cfg.open nvidia_x11.firmware;
|
||||
|
||||
systemd.tmpfiles.rules =
|
||||
|
|
|
@ -196,9 +196,12 @@ installPhase() {
|
|||
mkdir -p $bin/share/man/man1
|
||||
cp -p *.1.gz $bin/share/man/man1
|
||||
rm -f $bin/share/man/man1/{nvidia-xconfig,nvidia-settings,nvidia-persistenced}.1.gz
|
||||
if [ -e "nvidia-dbus.conf" ]; then
|
||||
install -Dm644 nvidia-dbus.conf $bin/share/dbus-1/system.d/nvidia-dbus.conf
|
||||
fi
|
||||
|
||||
# Install the programs.
|
||||
for i in nvidia-cuda-mps-control nvidia-cuda-mps-server nvidia-smi nvidia-debugdump; do
|
||||
for i in nvidia-cuda-mps-control nvidia-cuda-mps-server nvidia-smi nvidia-debugdump nvidia-powerd; do
|
||||
if [ -e "$i" ]; then
|
||||
install -Dm755 $i $bin/bin/$i
|
||||
# unmodified binary backup for mounting in containers
|
||||
|
|
|
@ -51,6 +51,7 @@ let
|
|||
libdrm xorg.libXext xorg.libX11
|
||||
xorg.libXv xorg.libXrandr xorg.libxcb zlib stdenv.cc.cc
|
||||
wayland mesa libGL openssl
|
||||
dbus # for nvidia-powerd
|
||||
]);
|
||||
|
||||
self = stdenv.mkDerivation {
|
||||
|
|
Loading…
Reference in a new issue