2024-02-11 20:17:19 +00:00
|
|
|
{ config
|
|
|
|
, lib
|
|
|
|
, pkgs
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.coolercontrol;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
##### interface
|
|
|
|
options = {
|
2024-04-13 09:35:04 +00:00
|
|
|
programs.coolercontrol = {
|
2024-04-13 12:54:15 +00:00
|
|
|
enable = lib.mkEnableOption "CoolerControl GUI & its background services";
|
2024-04-13 09:35:04 +00:00
|
|
|
|
|
|
|
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";
|
2024-04-13 12:54:15 +00:00
|
|
|
description = ''
|
2024-04-13 09:35:04 +00:00
|
|
|
Enable support for Nvidia GPUs.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
2024-02-11 20:17:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
##### implementation
|
2024-04-13 09:35:04 +00:00
|
|
|
config = lib.mkIf cfg.enable (lib.mkMerge [
|
|
|
|
# Common
|
|
|
|
({
|
|
|
|
environment.systemPackages = with pkgs.coolercontrol; [
|
|
|
|
coolercontrol-gui
|
2024-02-11 20:17:19 +00:00
|
|
|
];
|
|
|
|
|
2024-04-13 09:35:04 +00:00
|
|
|
systemd = {
|
|
|
|
packages = with pkgs.coolercontrol; [
|
|
|
|
coolercontrol-liqctld
|
|
|
|
coolercontrold
|
|
|
|
];
|
|
|
|
|
|
|
|
# https://github.com/NixOS/nixpkgs/issues/81138
|
|
|
|
services = {
|
|
|
|
coolercontrol-liqctld.wantedBy = [ "multi-user.target" ];
|
|
|
|
coolercontrold.wantedBy = [ "multi-user.target" ];
|
|
|
|
};
|
2024-02-11 20:17:19 +00:00
|
|
|
};
|
2024-04-13 09:35:04 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
# Nvidia support
|
|
|
|
(lib.mkIf cfg.nvidiaSupport {
|
|
|
|
systemd.services.coolercontrold.path = with config.boot.kernelPackages; [
|
|
|
|
nvidia_x11 # nvidia-smi
|
|
|
|
nvidia_x11.settings # nvidia-settings
|
|
|
|
];
|
|
|
|
})
|
|
|
|
]);
|
2024-02-11 20:17:19 +00:00
|
|
|
|
|
|
|
meta.maintainers = with lib.maintainers; [ OPNA2608 codifryed ];
|
|
|
|
}
|