nixos/coolercontrol: fix nvidia support
This commit is contained in:
@@ -13,18 +13,16 @@ in
|
|||||||
options = {
|
options = {
|
||||||
programs.coolercontrol = {
|
programs.coolercontrol = {
|
||||||
enable = lib.mkEnableOption "CoolerControl GUI & its background services";
|
enable = lib.mkEnableOption "CoolerControl GUI & its background services";
|
||||||
|
|
||||||
nvidiaSupport = lib.mkOption {
|
|
||||||
type = lib.types.bool;
|
|
||||||
default = lib.elem "nvidia" config.services.xserver.videoDrivers;
|
|
||||||
defaultText = lib.literalExpression "lib.elem \"nvidia\" config.services.xserver.videoDrivers";
|
|
||||||
description = ''
|
|
||||||
Enable support for Nvidia GPUs.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
# Added 2025-10-25
|
||||||
|
(lib.mkRemovedOptionModule [ "programs" "coolercontrol" "nvidiaSupport" ] ''
|
||||||
|
This option is deprecated as Nvidia drivers are automatically loaded at runtime.
|
||||||
|
'')
|
||||||
|
];
|
||||||
|
|
||||||
##### implementation
|
##### implementation
|
||||||
config = lib.mkIf cfg.enable (
|
config = lib.mkIf cfg.enable (
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
@@ -47,18 +45,6 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
# Nvidia support
|
|
||||||
(lib.mkIf cfg.nvidiaSupport {
|
|
||||||
systemd.services.coolercontrold.path =
|
|
||||||
let
|
|
||||||
nvidiaPkg = config.hardware.nvidia.package;
|
|
||||||
in
|
|
||||||
[
|
|
||||||
nvidiaPkg # nvidia-smi
|
|
||||||
nvidiaPkg.settings # nvidia-settings
|
|
||||||
];
|
|
||||||
})
|
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
libdrm,
|
libdrm,
|
||||||
coolercontrol,
|
coolercontrol,
|
||||||
runtimeShell,
|
runtimeShell,
|
||||||
|
addDriverRunpath,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -20,6 +21,7 @@ rustPlatform.buildRustPackage {
|
|||||||
cargoHash = "sha256-ZyYyQcaYd3VZ7FL0Hki33JO3LscPfBT5gl+nw2cXvUs=";
|
cargoHash = "sha256-ZyYyQcaYd3VZ7FL0Hki33JO3LscPfBT5gl+nw2cXvUs=";
|
||||||
|
|
||||||
buildInputs = [ libdrm ];
|
buildInputs = [ libdrm ];
|
||||||
|
nativeBuildInputs = [ addDriverRunpath ];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
# copy the frontend static resources to a directory for embedding
|
# copy the frontend static resources to a directory for embedding
|
||||||
@@ -37,6 +39,10 @@ rustPlatform.buildRustPackage {
|
|||||||
--replace-fail '/usr/bin' "$out/bin"
|
--replace-fail '/usr/bin' "$out/bin"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
addDriverRunpath "$out/bin/coolercontrold"
|
||||||
|
'';
|
||||||
|
|
||||||
passthru.tests.version = testers.testVersion {
|
passthru.tests.version = testers.testVersion {
|
||||||
package = coolercontrol.coolercontrold;
|
package = coolercontrol.coolercontrold;
|
||||||
# coolercontrold prints its version with "v" prefix
|
# coolercontrold prints its version with "v" prefix
|
||||||
|
|||||||
Reference in New Issue
Block a user