{pkgs, lib, config, ...}: with lib; { options.services.vector = { enable = mkEnableOption "Enable the vector agent"; settings = mkOption { description = "Settings for the vector agent"; default = { data_dir = "/var/lib/vector"; }; defaultText = "{}"; }; }; config = { environment.etc."vector.yaml" = mkIf config.services.vector.enable { text = (generators.toYAML {} config.services.vector.settings); }; launchd.daemons.vector = mkIf config.services.vector.enable { serviceConfig = { ProgramArguments = [ "${pkgs.vector}/bin/vector" "--watch-config" "--config=/etc/${config.environment.etc."vector.yaml".target}" ]; KeepAlive = true; RunAtLoad = true; StandardOutPath = "/var/log/vector.out.log"; StandardErrorPath = "/var/log/vector.err.log"; }; }; }; }