2025-10-09 15:34:37 +02:00
|
|
|
{pkgs, ...}:
|
|
|
|
|
let
|
|
|
|
|
imports = ../../config/globals.nix ;
|
|
|
|
|
in {
|
2025-09-24 23:33:06 +02:00
|
|
|
environment.systemPackages = with pkgs; [
|
|
|
|
|
goaccess
|
|
|
|
|
];
|
|
|
|
|
|
2025-10-05 08:20:57 +02:00
|
|
|
# Service pour générer le rapport statique GoAccess
|
2025-09-24 23:33:06 +02:00
|
|
|
systemd.services.goaccess-report = {
|
|
|
|
|
description = "Generate GoAccess HTML report";
|
|
|
|
|
serviceConfig = {
|
2025-10-09 15:34:37 +02:00
|
|
|
ExecStart = "${pkgs.goaccess}/bin/goaccess /var/log/caddy/access-${globals.services.levr.url}.log --log-format=CADDY -o ${globals.services.goaccess.home}/index.html";
|
2025-09-24 23:33:06 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-05 08:20:57 +02:00
|
|
|
# Timer pour régénérer le rapport toutes les heures
|
2025-09-24 23:33:06 +02:00
|
|
|
systemd.timers.goaccess-report = {
|
|
|
|
|
description = "Hourly GoAccess report generation";
|
2025-10-05 08:20:57 +02:00
|
|
|
wantedBy = ["timers.target"];
|
2025-09-24 23:33:06 +02:00
|
|
|
timerConfig = {
|
|
|
|
|
OnCalendar = "hourly";
|
|
|
|
|
Persistent = true;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
services.caddy = {
|
|
|
|
|
virtualHosts = {
|
2025-10-09 15:34:37 +02:00
|
|
|
globals.services.goaccess.url = {
|
2025-09-24 23:33:06 +02:00
|
|
|
extraConfig = ''
|
2025-10-09 15:34:37 +02:00
|
|
|
root * ${globals.services.goaccess.home}
|
2025-09-24 23:33:06 +02:00
|
|
|
file_server browse
|
|
|
|
|
try_files {path} {path}/ /index.html
|
|
|
|
|
|
2025-10-05 08:20:57 +02:00
|
|
|
'';
|
2025-09-24 23:33:06 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2025-10-05 08:20:57 +02:00
|
|
|
}
|