1 { config, pkgs, lib, ... }:
3 cfg = config.programs.tuxclocker;
6 options.programs.tuxclocker = {
7 enable = lib.mkEnableOption ''
8 TuxClocker, a hardware control and monitoring program
11 enableAMD = lib.mkEnableOption ''
13 Sets the `amdgpu.ppfeaturemask` kernel parameter to 0xfffd7fff to enable all TuxClocker controls
16 enabledNVIDIADevices = lib.mkOption {
17 type = lib.types.listOf lib.types.int;
21 Enable NVIDIA GPU controls for a device by index.
22 Sets the `Coolbits` Xorg option to enable all TuxClocker controls.
26 useUnfree = lib.mkOption {
27 type = lib.types.bool;
31 Whether to use components requiring unfree dependencies.
32 Disabling this allows you to get everything from the binary cache.
38 package = if cfg.useUnfree then pkgs.tuxclocker else pkgs.tuxclocker-without-unfree;
41 environment.systemPackages = [
45 services.dbus.packages = [
49 # MSR is used for some features
50 boot.kernelModules = [ "msr" ];
52 # https://download.nvidia.com/XFree86/Linux-x86_64/430.14/README/xconfigoptions.html#Coolbits
53 services.xserver.config = let
54 configSection = (i: ''
57 Option "Coolbits" "31"
58 Identifier "Device-nvidia[${toString i}]"
62 lib.concatStrings (map configSection cfg.enabledNVIDIADevices);
64 # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/amd/include/amd_shared.h#n207
65 # Enable everything modifiable in TuxClocker
66 boot.kernelParams = lib.mkIf cfg.enableAMD [ "amdgpu.ppfeaturemask=0xfffd7fff" ];