10 cfg = config.services.goatcounter;
11 stateDir = "goatcounter";
16 services.goatcounter = {
17 enable = lib.mkEnableOption "goatcounter";
19 package = lib.mkPackageOption pkgs "goatcounter" { };
21 address = lib.mkOption {
23 default = "127.0.0.1";
24 description = "Web interface address.";
30 description = "Web interface port.";
33 proxy = lib.mkOption {
37 Whether Goatcounter service is running behind a reverse proxy. Will listen for HTTPS if `false`.
38 Refer to [documentation](https://github.com/arp242/goatcounter?tab=readme-ov-file#running) for more details.
42 extraArgs = lib.mkOption {
43 type = with types; listOf str;
46 List of extra arguments to be passed to goatcounter cli.
47 See {command}`goatcounter help serve` for more information.
53 config = lib.mkIf cfg.enable {
54 systemd.services.goatcounter = {
55 description = "Easy web analytics. No tracking of personal data.";
56 wantedBy = [ "multi-user.target" ];
58 ExecStart = lib.escapeShellArgs (
60 (lib.getExe cfg.package)
63 "${cfg.address}:${toString cfg.port}"
65 ++ lib.optionals cfg.proxy [
72 StateDirectory = stateDir;
73 WorkingDirectory = "%S/${stateDir}";
79 meta.maintainers = with lib.maintainers; [ bhankas ];