main
1{lib, ...}: {
2 flake.modules.nixos."services/goatcounter" = {config, ...}: {
3 services.goatcounter = {
4 enable = true;
5 address = "127.0.0.1";
6 port = 4627;
7 proxy = true;
8 extraArgs = [];
9 };
10
11 services.caddy.virtualHosts."goatcounter.hpcesia.com".extraConfig =
12 lib.mkIf config.services.caddy.enable
13 (let
14 localAddress = "http://localhost:${builtins.toString config.services.goatcounter.port}";
15 in ''
16 encode zstd gzip
17 reverse_proxy ${localAddress}
18 '');
19
20 services.restic.backups."${config.networking.hostName}-backup".paths =
21 lib.mkIf
22 (builtins.hasAttr "${config.networking.hostName}-backup" config.services.restic.backups)
23 ["/var/lib/goatcounter"];
24 };
25}