diff --git a/nix-system-configs/modules/system/gramethus.nix b/nix-system-configs/modules/system/gramethus.nix index 1b73109..32ea262 100644 --- a/nix-system-configs/modules/system/gramethus.nix +++ b/nix-system-configs/modules/system/gramethus.nix @@ -13,38 +13,6 @@ fsType = "ext4"; }; }; - - environment.etc.alloy.config.alloy = { - text = '' - server: - http_listen_port: 28183 - grpc_listen_port: 0 - - logs: - # keep positions persistent on disk (don't use /tmp in production) - positions: - filename: /var/lib/grafana-agent/positions.yaml - - configs: - - name: journal - journal: - # keep similar rotation / lookback to your promtail config - max_age: 12h - labels: - job: systemd-journal - host: chrysalis - - clients: - - url: http://127.0.0.1:3100/loki/api/v1/push - - relabel_configs: - - source_labels: ["__journal__systemd_unit"] - target_label: "unit" - ''; - owner = "root"; - group = "root"; - mode = "0644"; - }; in { options.local = { hostname = lib.mkOption { @@ -196,7 +164,6 @@ in { allow_structured_metadata = false; }; - table_manager = { retention_deletes_enabled = false; retention_period = "0s"; @@ -208,6 +175,38 @@ in { enable = true; }; + environment.etc.alloy.config.alloy = { + text = '' + server: + http_listen_port: 28183 + grpc_listen_port: 0 + + logs: + # keep positions persistent on disk (don't use /tmp in production) + positions: + filename: /var/lib/grafana-agent/positions.yaml + + configs: + - name: journal + journal: + # keep similar rotation / lookback to your promtail config + max_age: 12h + labels: + job: systemd-journal + host: chrysalis + + clients: + - url: http://127.0.0.1:3100/loki/api/v1/push + + relabel_configs: + - source_labels: ["__journal__systemd_unit"] + target_label: "unit" + ''; + owner = "root"; + group = "root"; + mode = "0644"; + }; + # Add a simple systemd service to run the Grafana Agent (Alloy) systemd.services.grafana-agent = { description = "Grafana Alloy"; @@ -216,7 +215,7 @@ in { serviceConfig = { # The grafana-agent binary provided by nixpkgs ExecStart = '' - ${pkgs.grafana-alloy}/bin/alloy + ${pkgs.grafana-alloy}/bin/alloy run ''; Restart = "on-failure";