{ config, pkgs, sops-nix, ... }: { # Promtail Logging # Import the file: sops.defaultSopsFile = ./secrets/secrets.yaml; # Define the secrets config.sops.secrets.promtail.user = {}; config.sops.secrets.promtail.pass = {}; config.sops.secrets.promtail.url = {}; # Install the package environment.systemPackages = with pkgs; [ promtail ]; # Configure the package: # https://mynixos.com/nixpkgs/option/services.promtail.configuration services.promtail = { enable = true; configuration = { server = { http_listen_port = 3031; grpc_listen_port = 0; }; positions = { filename = "/tmp/positions.yaml"; }; clients = [{ url = config.sops.secrets.promtail.url.path; basic_auth = { username = config.sops.secrets.promtail.user.path; password = config.sops.secrets.promtail.pass.path; }; }]; scrape_configs = [{ job_name = "journal"; journal = { max_age = "12h"; labels = { job = "systemd-journal"; host = "nixos-p1"; }; }; relabel_configs = [{ source_labels = [ "__journal__systemd_unit" ]; target_label = "unit"; }]; }]; }; }; }