nixos/thermald: Allow switching package

Sometimes newer versions than what nixpkgs provides is needed for
certain hardware, especially for stable releases where I will backport
this commit.
This commit is contained in:
John Ericson 2020-12-21 18:13:41 +00:00
parent e49c1a0027
commit 4bded92554

View File

@ -23,19 +23,26 @@ in {
default = null; default = null;
description = "the thermald manual configuration file."; description = "the thermald manual configuration file.";
}; };
package = mkOption {
type = types.package;
default = pkgs.thermald;
defaultText = "pkgs.thermald";
description = "Which thermald package to use.";
};
}; };
}; };
###### implementation ###### implementation
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.dbus.packages = [ pkgs.thermald ]; services.dbus.packages = [ cfg.package ];
systemd.services.thermald = { systemd.services.thermald = {
description = "Thermal Daemon Service"; description = "Thermal Daemon Service";
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
serviceConfig = { serviceConfig = {
ExecStart = '' ExecStart = ''
${pkgs.thermald}/sbin/thermald \ ${cfg.package}/sbin/thermald \
--no-daemon \ --no-daemon \
${optionalString cfg.debug "--loglevel=debug"} \ ${optionalString cfg.debug "--loglevel=debug"} \
${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \ ${optionalString (cfg.configFile != null) "--config-file ${cfg.configFile}"} \