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

@ -3,12 +3,6 @@
with lib;
let
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 {
options.modules.services.forgejo = {
enable = mkEnableOption "enable forgejo, a lightweight git server";
@ -37,15 +31,6 @@ in {
PASSWORD_HASH_ALGO = "argon2";
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" = {
AUTHOR = "reidlab";
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
'';
};
};
}

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";
};
}
];
};
};
};
}

View 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";
};
};
};
};
}

View file

@ -11,7 +11,6 @@ in {
config = mkIf cfg.enable {
services.postgresql = {
enable = true;
package = pkgs.postgresql_14;
};
};