mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
nixos/coolercontrol: Add support for Nvidia hardware
This commit is contained in:
parent
bbc0a5ee52
commit
29ef3d58b5
1 changed files with 40 additions and 18 deletions
|
@ -10,28 +10,50 @@ in
|
|||
{
|
||||
##### interface
|
||||
options = {
|
||||
programs.coolercontrol.enable = lib.mkEnableOption (lib.mdDoc "CoolerControl GUI & its background services");
|
||||
};
|
||||
programs.coolercontrol = {
|
||||
enable = lib.mkEnableOption (lib.mdDoc "CoolerControl GUI & its background services");
|
||||
|
||||
##### implementation
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs.coolercontrol; [
|
||||
coolercontrol-gui
|
||||
];
|
||||
|
||||
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" ];
|
||||
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 = lib.mdDoc ''
|
||||
Enable support for Nvidia GPUs.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
##### implementation
|
||||
config = lib.mkIf cfg.enable (lib.mkMerge [
|
||||
# Common
|
||||
({
|
||||
environment.systemPackages = with pkgs.coolercontrol; [
|
||||
coolercontrol-gui
|
||||
];
|
||||
|
||||
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" ];
|
||||
};
|
||||
};
|
||||
})
|
||||
|
||||
# Nvidia support
|
||||
(lib.mkIf cfg.nvidiaSupport {
|
||||
systemd.services.coolercontrold.path = with config.boot.kernelPackages; [
|
||||
nvidia_x11 # nvidia-smi
|
||||
nvidia_x11.settings # nvidia-settings
|
||||
];
|
||||
})
|
||||
]);
|
||||
|
||||
meta.maintainers = with lib.maintainers; [ OPNA2608 codifryed ];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue