aboutsummaryrefslogtreecommitdiff
path: root/example.flake.nix
blob: 2095130fb3bfb1289f7b47773db74d90f1208cb5 (plain)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Author: Euxane TRAN-GIRARD
# Licence: EUPL-1.2

{
  description = "Example usage of tickwatch as a monitoring service";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    tickwatch = {
      url = "git+https://cgit.euxane.eu/tickwatch";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = inputs: {
    nixosConfigurations.example = inputs.nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ({ ... }: {
          imports = [
            inputs.tickwatch.nixosModules.program
            inputs.tickwatch.nixosModules.service
          ];

          config = {
            nixpkgs.overlays = [
              inputs.tickwatch.overlays.default
            ];

            programs.tickwatch.enable = true;

            services.tickwatch.monitors = {
              ping-example-ipv4 = {
                monitor = "ping";
                target = "4/example.net";
                logFile = "/var/log/tickwatch/ping-example-ipv4.log";
                settings.range = "0:1000";
              };
            };
          };
        })
      ];
    };
  };
}