feat(lin-va-desktop): add systemd services for NVIDIA power limit

This commit is contained in:
2026-05-02 14:00:49 -04:00
parent 8d45977154
commit f00edb620c

View File

@@ -1,4 +1,5 @@
{ namespace { namespace
, config
, pkgs , pkgs
, lib , lib
, ... , ...
@@ -6,6 +7,7 @@
let let
inherit (lib.${namespace}) enabled; inherit (lib.${namespace}) enabled;
nvidia-smi = "${config.hardware.nvidia.package.bin}/bin/nvidia-smi";
llama-cpp = pkgs.reichard.llama-cpp; llama-cpp = pkgs.reichard.llama-cpp;
stable-diffusion-cpp = pkgs.reichard.stable-diffusion-cpp.override { stable-diffusion-cpp = pkgs.reichard.stable-diffusion-cpp.override {
cudaSupport = true; cudaSupport = true;
@@ -46,6 +48,27 @@ in
allowedTCPPorts = [ 8081 ]; allowedTCPPorts = [ 8081 ];
}; };
# NVIDIA GPU Power Limit
systemd.services = {
nvidia-persistence-mode = {
description = "Enable NVIDIA GPU Persistence Mode";
after = [ "nvidia-modules-load.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
script = "${nvidia-smi} -pm 1";
};
nvidia-power-limit = {
description = "Set NVIDIA GPU Power Limit";
after = [ "nvidia-persistence-mode.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
serviceConfig.RemainAfterExit = true;
script = "${nvidia-smi} -i 0 -pl 250";
};
};
# System Config # System Config
reichard = { reichard = {
nix = enabled; nix = enabled;