diff --git a/nix/base-system/modules/darwin-monitor.nix b/nix/base-system/modules/darwin-monitor.nix index bbdec9f..86fac81 100644 --- a/nix/base-system/modules/darwin-monitor.nix +++ b/nix/base-system/modules/darwin-monitor.nix @@ -18,6 +18,11 @@ with lib; default = "localhost:9001"; defaultText = "localhost:9001"; }; + logsPath = mkOption rec { + description = "Path to save heracles log files to"; + default = "/Users/zaphar/opt/heracles"; + defaultText = default; + }; settings = mkOption { description = "Settings for the heracles dashboards"; default = []; @@ -88,10 +93,10 @@ with lib; ]; }''; }; - dataPath = mkOption { + dataPath = mkOption rec { description = "Storage path for the tsdb"; default = "/Users/zaphar/opt/prometheus"; - defaultText = "~/opt/prometheus"; + defaultText = default; }; }; @@ -126,8 +131,8 @@ with lib; WatchPaths = [ "/etc/${config.environment.etc."heracles.yaml".target}" ]; - StandardOutPath = "/var/log/heracles.log"; - StandardErrorPath = "/var/log/heracles.err.log"; + StandardOutPath = "${config.services.heracles.logsPath}/heracles.log"; + StandardErrorPath = "${config.services.heracles.logsPath}/heracles.err.log"; KeepAlive = true; RunAtLoad = true; }; @@ -153,11 +158,11 @@ with lib; "${pkgs.prometheus}/bin/prometheus" "--web.listen-address=${config.services.prometheus.listen}" "--config.file=/etc/${config.environment.etc."prometheus.yaml".target}" - #"--storage.tsdb.path=${config.services.prometheus.dataPath}" + "--storage.tsdb.path=${config.services.prometheus.dataPath}/data" ]; - StandardOutPath = "${config.services.prometheus.dataPath}/prometheus-out.log"; - StandardErrorPath = "${config.services.prometheus.dataPath}/prometheus-err.log"; - WorkingDirectory=config.services.prometheus.dataPath; + #StandardOutPath = "${config.services.prometheus.dataPath}/prometheus.out.log"; + #StandardErrorPath = "${config.services.prometheus.dataPath}/prometheus.err.log"; + WorkingDirectory = config.services.prometheus.dataPath; WatchPaths = [ "/etc/${config.environment.etc."prometheus.yaml".target}" ]; @@ -166,25 +171,25 @@ with lib; }; }; - environment.etc."newsyslog.d/org.nixos.prometheus.conf" = mkIf config.services.prometheus.enable { - text = '' - # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] - ${config.launchd.user.agents.prometheus.serviceConfig.StandardOutPath} 644 10 1000 * NJ - ${config.launchd.user.agents.prometheus.serviceConfig.StandardErrorPath} 644 10 1000 * NJ - ''; - }; + #environment.etc."newsyslog.d/org.nixos.prometheus.conf" = mkIf config.services.prometheus.enable { + # text = '' + # # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] + # ${config.launchd.user.agents.prometheus.serviceConfig.StandardOutPath} 644 10 1000 * BNJ + # ${config.launchd.user.agents.prometheus.serviceConfig.StandardErrorPath} 644 10 1000 * BNJ + # ''; + #}; environment.etc."newsyslog.d/org.nixos.heracles.conf" = mkIf config.services.prometheus.enable { text = '' # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] - ${config.launchd.user.agents.heracles.serviceConfig.StandardOutPath} 644 10 1000 * NJ - ${config.launchd.user.agents.heracles.serviceConfig.StandardErrorPath} 644 10 1000 * NJ + ${config.launchd.user.agents.heracles.serviceConfig.StandardOutPath} 644 10 1000 * BNJ + ${config.launchd.user.agents.heracles.serviceConfig.StandardErrorPath} 644 10 1000 * BNJ ''; }; environment.etc."newsyslog.d/org.nixos.durnitisp.conf" = mkIf config.services.durnitisp.enable { text = '' # logfilename [owner:group] mode count size when flags [/pid_file] [sig_num] - ${config.launchd.daemons.durnitisp.serviceConfig.StandardOutPath} 644 10 1000 * NJ - ${config.launchd.daemons.durnitisp.serviceConfig.StandardErrorPath} 644 10 1000 * NJ + ${config.launchd.daemons.durnitisp.serviceConfig.StandardOutPath} 644 10 1000 * BNJ + ${config.launchd.daemons.durnitisp.serviceConfig.StandardErrorPath} 644 10 1000 * BNJ ''; }; };