This commit is contained in:
Reid 2024-11-01 19:54:26 -07:00
parent 1a53db8ce1
commit 91509baa59
Signed by: reidlab
GPG key ID: DAF5EAF6665839FD
6 changed files with 82 additions and 24 deletions

View file

@ -0,0 +1,47 @@
{ config, lib, pkgs, options, ... }:
with lib;
let
cfg = config.modules.services.matomo;
in {
options.modules.services.matomo = {
enable = mkOption {
type = types.bool;
default = false;
};
domain = mkOption {
type = types.str;
default = "analytics.reidlab.pink";
};
};
config = mkIf cfg.enable {
services = {
matomo = {
enable = true;
package = pkgs.matomo-beta;
periodicArchiveProcessing = true;
hostname = cfg.domain;
nginx = {
serverAliases = [ cfg.domain ];
enableACME = true;
};
};
# matomo doesn't automatically create the database
# just. make sure its named matomo
mysql = {
ensureDatabases = [ "matomo" ];
ensureUsers = [
{
name = "matomo";
ensurePermissions = {
"matomo.*" = "ALL PRIVILEGES";
};
}
];
};
};
};
}