2023-12-14 10:19:50 +02:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.programs.tuxclocker;
|
|
|
|
in
|
|
|
|
{
|
2025-05-27 19:45:13 +05:30
|
|
|
imports = [
|
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
[ "programs" "tuxclocker" "enableAMD" ]
|
|
|
|
[ "hardware" "amdgpu" "overdrive" "enable" ]
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
2023-12-14 10:19:50 +02:00
|
|
|
options.programs.tuxclocker = {
|
2024-08-30 00:46:51 +02:00
|
|
|
enable = lib.mkEnableOption ''
|
2023-12-14 10:19:50 +02:00
|
|
|
TuxClocker, a hardware control and monitoring program
|
|
|
|
'';
|
|
|
|
|
2024-08-30 00:46:51 +02:00
|
|
|
enabledNVIDIADevices = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.int;
|
2023-12-14 10:19:50 +02:00
|
|
|
default = [ ];
|
|
|
|
example = [
|
|
|
|
0
|
|
|
|
1
|
|
|
|
];
|
|
|
|
description = ''
|
|
|
|
Enable NVIDIA GPU controls for a device by index.
|
|
|
|
Sets the `Coolbits` Xorg option to enable all TuxClocker controls.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2024-08-30 00:46:51 +02:00
|
|
|
useUnfree = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
2023-12-14 10:19:50 +02:00
|
|
|
default = false;
|
|
|
|
example = true;
|
|
|
|
description = ''
|
|
|
|
Whether to use components requiring unfree dependencies.
|
|
|
|
Disabling this allows you to get everything from the binary cache.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config =
|
|
|
|
let
|
|
|
|
package = if cfg.useUnfree then pkgs.tuxclocker else pkgs.tuxclocker-without-unfree;
|
|
|
|
in
|
2024-08-30 00:46:51 +02:00
|
|
|
lib.mkIf cfg.enable {
|
2023-12-14 10:19:50 +02:00
|
|
|
environment.systemPackages = [
|
|
|
|
package
|
|
|
|
];
|
|
|
|
|
|
|
|
services.dbus.packages = [
|
|
|
|
package
|
|
|
|
];
|
|
|
|
|
|
|
|
# MSR is used for some features
|
|
|
|
boot.kernelModules = [ "msr" ];
|
|
|
|
|
|
|
|
# https://download.nvidia.com/XFree86/Linux-x86_64/430.14/README/xconfigoptions.html#Coolbits
|
|
|
|
services.xserver.config =
|
|
|
|
let
|
|
|
|
configSection = (
|
|
|
|
i: ''
|
|
|
|
Section "Device"
|
|
|
|
Driver "nvidia"
|
|
|
|
Option "Coolbits" "31"
|
|
|
|
Identifier "Device-nvidia[${toString i}]"
|
|
|
|
EndSection
|
|
|
|
''
|
|
|
|
);
|
|
|
|
in
|
2024-08-30 00:46:51 +02:00
|
|
|
lib.concatStrings (map configSection cfg.enabledNVIDIADevices);
|
2023-12-14 10:19:50 +02:00
|
|
|
};
|
|
|
|
}
|