matomo!
This commit is contained in:
parent
1a53db8ce1
commit
91509baa59
6 changed files with 82 additions and 24 deletions
|
@ -38,6 +38,7 @@ in {
|
||||||
ssh.enableMoshSupport = true;
|
ssh.enableMoshSupport = true;
|
||||||
|
|
||||||
postgres.enable = true;
|
postgres.enable = true;
|
||||||
|
mysql.enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
security.useDoas = true;
|
security.useDoas = true;
|
||||||
|
|
|
@ -22,6 +22,11 @@ in {
|
||||||
"reidlab.pink".dataDir = "/var/www/reidlab.pink";
|
"reidlab.pink".dataDir = "/var/www/reidlab.pink";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
matomo = {
|
||||||
|
enable = true;
|
||||||
|
domain = "matomo.reidlab.pink";
|
||||||
|
};
|
||||||
|
|
||||||
metrics = {
|
metrics = {
|
||||||
enable = true;
|
enable = true;
|
||||||
domain = "grafana.reidlab.pink";
|
domain = "grafana.reidlab.pink";
|
||||||
|
|
|
@ -3,12 +3,6 @@
|
||||||
with lib;
|
with lib;
|
||||||
let
|
let
|
||||||
cfg = config.modules.services.forgejo;
|
cfg = config.modules.services.forgejo;
|
||||||
|
|
||||||
theme = pkgs.fetchzip {
|
|
||||||
url = "https://github.com/catppuccin/gitea/releases/download/v0.4.1/catppuccin-gitea.tar.gz";
|
|
||||||
sha256 = "1wi4gi431b8hpmk6cr05jygplj76p6jwwlihajxz9131aqxym1fp";
|
|
||||||
stripRoot = false;
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
options.modules.services.forgejo = {
|
options.modules.services.forgejo = {
|
||||||
enable = mkEnableOption "enable forgejo, a lightweight git server";
|
enable = mkEnableOption "enable forgejo, a lightweight git server";
|
||||||
|
@ -37,15 +31,6 @@ in {
|
||||||
PASSWORD_HASH_ALGO = "argon2";
|
PASSWORD_HASH_ALGO = "argon2";
|
||||||
PASSWORD_CHECK_PWN = true;
|
PASSWORD_CHECK_PWN = true;
|
||||||
};
|
};
|
||||||
"ui" = {
|
|
||||||
THEMES =
|
|
||||||
builtins.concatStringsSep
|
|
||||||
","
|
|
||||||
(["auto"]
|
|
||||||
++ (map (name: removePrefix "theme-" (removeSuffix ".css" name))
|
|
||||||
(attrNames (builtins.readDir theme))));
|
|
||||||
DEFAULT_THEME = "catppuccin-mocha-red";
|
|
||||||
};
|
|
||||||
"ui.meta" = {
|
"ui.meta" = {
|
||||||
AUTHOR = "reidlab";
|
AUTHOR = "reidlab";
|
||||||
DESCRIPTION = "reidlab's git instance";
|
DESCRIPTION = "reidlab's git instance";
|
||||||
|
@ -83,13 +68,5 @@ in {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.forgejo = {
|
|
||||||
preStart = mkAfter ''
|
|
||||||
rm -rf ${config.services.forgejo.customDir}/public/assets
|
|
||||||
mkdir -p ${config.services.forgejo.customDir}/public/assets
|
|
||||||
ln -sf ${theme} ${config.services.forgejo.customDir}/public/assets/css
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
47
modules/services/matomo.nix
Normal file
47
modules/services/matomo.nix
Normal 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";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
29
modules/services/mysql.nix
Normal file
29
modules/services/mysql.nix
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
{ config, lib, pkgs, options, ... }:
|
||||||
|
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.modules.services.mysql;
|
||||||
|
in {
|
||||||
|
options.modules.services.mysql = {
|
||||||
|
enable = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
services.mysql = {
|
||||||
|
enable = true;
|
||||||
|
package = pkgs.mariadb_110;
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
mysqld = {
|
||||||
|
max_allowed_packet = "128M";
|
||||||
|
};
|
||||||
|
client = {
|
||||||
|
max_allowed_packet = "128M";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -11,7 +11,6 @@ in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
services.postgresql = {
|
services.postgresql = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
package = pkgs.postgresql_14;
|
package = pkgs.postgresql_14;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue