light-control: fix log level

This commit is contained in:
Ingolf Wagner 2020-06-04 01:44:50 +02:00
parent 24fea3101a
commit b972289a3f
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
2 changed files with 6 additions and 1 deletions

View file

@ -1,6 +1,7 @@
{ pkgs, lib, config, ... }: { { pkgs, lib, config, ... }: {
services.mqtt.light-control.enable = true; services.mqtt.light-control.enable = true;
services.mqtt.light-control.loglevel = "debug";
services.mqtt.light-control.config = { services.mqtt.light-control.config = {
credentials = { credentials = {
host = "tcp://localhost:1883"; host = "tcp://localhost:1883";

View file

@ -32,6 +32,10 @@ in {
options.services.mqtt.light-control = { options.services.mqtt.light-control = {
enable = mkEnableOption "enable mqtt.light-control"; enable = mkEnableOption "enable mqtt.light-control";
loglevel = mkOption {
default = "info";
type = with types; enum [ "info" "trace" "debug" "error" "warning" ];
};
config = config =
mkMagicMergeOption { description = "configuration of light-control"; }; mkMagicMergeOption { description = "configuration of light-control"; };
}; };
@ -39,7 +43,7 @@ in {
config = mkIf cfg.enable { config = mkIf cfg.enable {
systemd.services."light-control" = { systemd.services."light-control" = {
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
environment = { RUST_LOG = "light_control=trace"; }; environment = { RUST_LOG = "light_control=${cfg.loglevel}"; };
script = '' script = ''
${pkgs.light-control}/bin/light-control ${lightControlConfig} ${pkgs.light-control}/bin/light-control ${lightControlConfig}
''; '';