nixpkgs/nixos/modules/programs/coolercontrol.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
1.4 KiB
Nix
Raw Normal View History

2024-02-11 20:17:19 +00:00
{ config
, lib
, pkgs
, ...
}:
let
cfg = config.programs.coolercontrol;
in
{
##### interface
options = {
programs.coolercontrol = {
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.
'';
};
};
2024-02-11 20:17:19 +00:00
};
##### implementation
config = lib.mkIf cfg.enable (lib.mkMerge [
# Common
({
environment.systemPackages = with pkgs.coolercontrol; [
coolercontrol-gui
2024-02-11 20:17:19 +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
};
})
# Nvidia support
(lib.mkIf cfg.nvidiaSupport {
systemd.services.coolercontrold.path = let
nvidiaPkg = config.hardware.nvidia.package;
in [
nvidiaPkg # nvidia-smi
nvidiaPkg.settings # nvidia-settings
];
})
]);
2024-02-11 20:17:19 +00:00
meta.maintainers = with lib.maintainers; [ OPNA2608 codifryed ];
}