diff --git a/module.nix b/module.nix index c6608bc..4b40c76 100644 --- a/module.nix +++ b/module.nix @@ -50,6 +50,8 @@ in { path = [ tattler ]; wantedBy = [ "default.target" ]; serviceConfig = { + DynamicUser = true; + LoadCredential = [ "mqtt.passwd:${cfg.mqtt.password-file}" ]; ExecStart = pkgs.writeShellScript "tattler.sh" (concatStringsSep " " ([ "tattler" "--mqtt-host=${cfg.mqtt.host}" @@ -59,7 +61,8 @@ in { ] ++ (optional cfg.verbose "--verbose") ++ (optional (cfg.mqtt.user != null) "--mqtt-user=${cfg.mqtt.user}") ++ (optional (cfg.mqtt.password-file != null) - "--mqtt-user=${cfg.mqtt.password-file}"))); + "--mqtt-user=$CREDENTIALS_DIRECTORY/mqtt.passwd"))); + Restart = "always"; }; }; }; diff --git a/src/tattler/core.clj b/src/tattler/core.clj index 8b8b630..7b7976e 100644 --- a/src/tattler/core.clj +++ b/src/tattler/core.clj @@ -26,6 +26,7 @@ :body (:body note) :urgency (-> note :urgency (keyword)) }) - (log/error! logger (format "rejecting invalid notification: %s" note))) + (log/error! logger (format "rejecting invalid notification: %s" + (->> note (t/explain Notification) (t/humanize))))) (recur (