1 { config, pkgs, lib, ... }:
6 cfg = config.programs.tuxclocker;
9 options.programs.tuxclocker = {
10 enable = mkEnableOption ''
11 TuxClocker, a hardware control and monitoring program
14 enableAMD = mkEnableOption ''
16 Sets the `amdgpu.ppfeaturemask` kernel parameter to 0xfffd7fff to enable all TuxClocker controls
19 enabledNVIDIADevices = mkOption {
20 type = types.listOf types.int;
24 Enable NVIDIA GPU controls for a device by index.
25 Sets the `Coolbits` Xorg option to enable all TuxClocker controls.
29 useUnfree = mkOption {
34 Whether to use components requiring unfree dependencies.
35 Disabling this allows you to get everything from the binary cache.
41 package = if cfg.useUnfree then pkgs.tuxclocker else pkgs.tuxclocker-without-unfree;
44 environment.systemPackages = [
48 services.dbus.packages = [
52 # MSR is used for some features
53 boot.kernelModules = [ "msr" ];
55 # https://download.nvidia.com/XFree86/Linux-x86_64/430.14/README/xconfigoptions.html#Coolbits
56 services.xserver.config = let
57 configSection = (i: ''
60 Option "Coolbits" "31"
61 Identifier "Device-nvidia[${toString i}]"
65 concatStrings (map configSection cfg.enabledNVIDIADevices);
67 # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/amd/include/amd_shared.h#n207
68 # Enable everything modifiable in TuxClocker
69 boot.kernelParams = mkIf cfg.enableAMD [ "amdgpu.ppfeaturemask=0xfffd7fff" ];