{ config, pkgs, ... }: { imports = [ ../settings/services/searchix.nix ../../packages/modules/nixos/goaccess.nix ]; services.searchix.settings.web = { baseURL = "https://searchix.ovh"; }; services.caddy.virtualHosts = { "searchix.ovh" = { extraConfig = '' root ${pkgs.searchix}/lib/searchix handle_errors { rewrite * /error.html templates file_server } handle_path /stats/* { root /srv/http/access/searchix file_server } handle { reverse_proxy localhost:${toString config.services.searchix.settings.web.port} { health_uri /health health_status 2xx health_interval 10s health_timeout 1s health_fails 2 } } encode zstd gzip { match { header Content-Type text/* header Content-Type application/json* header Content-Type application/javascript* header Content-Type application/opensearchdescription+xml header Content-Type application/atom+xml* header Content-Type application/rss+xml* header Content-Type image/svg+xml* } } ''; }; "searchix.alanpearce.eu" = { extraConfig = '' redir https://searchix.ovh{uri} permanent ''; }; }; services.goaccess = { group = "caddy"; instances = { searchix = { enable = false; dates = "hourly"; settings = { log-file = "${config.services.caddy.logDir}/access-searchix.ovh.log"; output = "/srv/http/access/searchix/index.html"; log-format = "caddy"; anonymize-ip = true; anonymize-level = 2; persist = true; restore = true; keep-last = 90; # days }; }; }; }; }