servers/common/services/goatcounter.nix

48 lines
872 B
Nix
Raw Normal View History

2025-07-14 00:40:10 -05:00
{
config,
lib,
pkgs,
...
2026-02-24 00:00:35 -08:00
}:
let
2025-07-14 00:40:10 -05:00
inherit (lib) mkEnableOption mkIf mkOption;
cfg = config.foehammer.services.goatcounter;
2026-02-24 00:00:35 -08:00
in
{
2025-07-14 00:40:10 -05:00
options.foehammer.services.goatcounter = {
enable = mkEnableOption "Enable goatcounter server";
port = mkOption {
type = lib.types.port;
default = 8223;
description = ''
What external port to serve over.
'';
};
};
config = mkIf cfg.enable {
users.users.goatcounter = {
isSystemUser = true;
createHome = true;
group = "goatcounter";
};
2026-02-24 00:00:35 -08:00
users.groups.goatcounter = { };
2025-07-14 00:40:10 -05:00
systemd.services.goatcounter = {
serviceConfig = {
User = "goatcounter";
DynamicUser = lib.mkForce false;
};
};
services.goatcounter = {
enable = true;
proxy = true;
address = "0.0.0.0";
port = cfg.port;
};
};
}