about summary refs log tree commit diff
path: root/ops/modules/journaldriver.nix
blob: 0d6b0bcc7f638d93b3b2809e3df1f9f6a749b356 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Configures journaldriver to forward to the tvl-fyi GCP project from
# TVL machines.
{ config, depot, lib, pkgs, ... }:

{
  imports = [
    (depot.third_party.agenix.src + "/modules/age.nix")
  ];

  age.secrets.journaldriver.file = depot.ops.secrets."journaldriver.age";

  services.journaldriver = {
    enable = true;
    googleCloudProject = "tvl-fyi";
    logStream = config.networking.hostName;
  };

  # Override the systemd service defined in the nixpkgs module to use
  # the credentials provided by agenix.
  systemd.services.journaldriver = {
    serviceConfig = {
      LoadCredential = "journaldriver.json:/run/agenix/journaldriver";
      ExecStart = lib.mkForce "${pkgs.coreutils}/bin/env GOOGLE_APPLICATION_CREDENTIALS=\"\${CREDENTIALS_DIRECTORY}/journaldriver.json\" ${depot.ops.journaldriver}/bin/journaldriver";
    };
  };
}