modules/amdgpu-fan: fix package import path

This commit is contained in:
xeals 2020-10-18 14:39:36 +11:00
parent 202ea9929b
commit 32e8d6c12d
Signed by: xeals
GPG Key ID: A498C7AF27EC6B5C

View File

@ -13,6 +13,12 @@ in
options.services.amdgpu.fan = { options.services.amdgpu.fan = {
enable = mkEnableOption "amdgpu-fan"; enable = mkEnableOption "amdgpu-fan";
package = mkOption {
type = types.package;
default = pkgs.amdgpu-fan or (import ../../.. { inherit pkgs; }).amdgpu-fan;
defaultText = "pkgs.amdgpu-fan";
};
speedMatrix = mkOption { speedMatrix = mkOption {
type = with types; listOf (listOf int); type = with types; listOf (listOf int);
# Translated from upstream default config. Since it tries to write the # Translated from upstream default config. Since it tries to write the
@ -45,7 +51,7 @@ in
config = mkIf cfg.enable { config = mkIf cfg.enable {
assertions = singleton { assertions = singleton {
assertion = all (speeds: length speeds == 2) cfg.speedMatrix; assertion = all (speeds: length speeds == 2) cfg.speedMatrix;
message = "services.amdgpu-fan.speedMatrix must be a list of paired lists"; message = "services.amdgpu.fan.speedMatrix must be a list of paired lists";
}; };
environment.etc."amdgpu-fan.yml".text = builtins.toJSON { environment.etc."amdgpu-fan.yml".text = builtins.toJSON {
@ -60,9 +66,9 @@ in
amdgpu-fan = { amdgpu-fan = {
description = "amdgpu fan controller"; description = "amdgpu fan controller";
wantedBy = [ "default.target" ]; wantedBy = [ "default.target" ];
after = [ "enable-manual-amdgpu-fan.service" ]; after = [ "amdgpu-pwm.service" ];
serviceConfig = { serviceConfig = {
ExecStart = "${pkgs.amdgpu-fan}/bin/amdgpu-fan"; ExecStart = "${cfg.package}/bin/amdgpu-fan";
Restart = "always"; Restart = "always";
}; };
}; };