39 lines
878 B
Nix
39 lines
878 B
Nix
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}: let
|
|
inherit (lib.modules) mkIf;
|
|
inherit (lib.options) mkEnableOption;
|
|
cfg = config.modules.system.services.plausible;
|
|
|
|
port = 4030;
|
|
domain = "analytics.copeberg.org";
|
|
in {
|
|
options.modules.system.services.plausible.enable = mkEnableOption "Plausible, an analytics service";
|
|
config = mkIf cfg.enable {
|
|
services.plausible = {
|
|
enable = true;
|
|
server = {
|
|
baseUrl = domain;
|
|
secretKeybaseFile = "/run/secrets/plausible-secret-key-base";
|
|
disableRegistration = false;
|
|
};
|
|
database.postgres = {
|
|
dbname = "plausible";
|
|
};
|
|
};
|
|
|
|
services.nginx = {
|
|
enable = true;
|
|
virtualHosts.${domain} = {
|
|
addSSL = true;
|
|
enableACME = true;
|
|
locations."/" = {
|
|
proxyPass = "http://localhost:${toString port}";
|
|
};
|
|
};
|
|
};
|
|
};
|
|
}
|