nixos/programs.tuxclocker: remove with lib;

This commit is contained in:
Felix Buehler 2024-08-30 00:46:51 +02:00
parent 11904bba73
commit f89578e797

View File

@ -1,23 +1,20 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.tuxclocker;
in
{
options.programs.tuxclocker = {
enable = mkEnableOption ''
enable = lib.mkEnableOption ''
TuxClocker, a hardware control and monitoring program
'';
enableAMD = mkEnableOption ''
enableAMD = lib.mkEnableOption ''
AMD GPU controls.
Sets the `amdgpu.ppfeaturemask` kernel parameter to 0xfffd7fff to enable all TuxClocker controls
'';
enabledNVIDIADevices = mkOption {
type = types.listOf types.int;
enabledNVIDIADevices = lib.mkOption {
type = lib.types.listOf lib.types.int;
default = [ ];
example = [ 0 1 ];
description = ''
@ -26,8 +23,8 @@ in
'';
};
useUnfree = mkOption {
type = types.bool;
useUnfree = lib.mkOption {
type = lib.types.bool;
default = false;
example = true;
description = ''
@ -40,7 +37,7 @@ in
config = let
package = if cfg.useUnfree then pkgs.tuxclocker else pkgs.tuxclocker-without-unfree;
in
mkIf cfg.enable {
lib.mkIf cfg.enable {
environment.systemPackages = [
package
];
@ -62,10 +59,10 @@ in
EndSection
'');
in
concatStrings (map configSection cfg.enabledNVIDIADevices);
lib.concatStrings (map configSection cfg.enabledNVIDIADevices);
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/amd/include/amd_shared.h#n207
# Enable everything modifiable in TuxClocker
boot.kernelParams = mkIf cfg.enableAMD [ "amdgpu.ppfeaturemask=0xfffd7fff" ];
boot.kernelParams = lib.mkIf cfg.enableAMD [ "amdgpu.ppfeaturemask=0xfffd7fff" ];
};
}