system/services/forgejo: add catppuccin

This commit is contained in:
Anthony Rodriguez 2024-12-03 09:23:18 +01:00
parent f79cae3815
commit c1887a3d0a
Signed by: nezia
GPG key ID: EE3BE97C040A86CE

View file

@ -1,9 +1,18 @@
{
config,
lib,
pkgs,
...
}: let
inherit (lib) mkAfter removePrefix removeSuffix;
srv = config.services.forgejo.settings.server;
# https://github.com/isabelroses/dotfiles/blob/06f8f70914c8e672541a52563ee624ce2e62adfb/modules/nixos/services/selfhosted/forgejo.nix#L19-L23
theme = pkgs.fetchzip {
url = "https://github.com/catppuccin/gitea/releases/download/v1.0.1/catppuccin-gitea.tar.gz";
sha256 = "et5luA3SI7iOcEIQ3CVIu0+eiLs8C/8mOitYlWQa/uI=";
stripRoot = false;
};
in {
services = {
forgejo = {
@ -28,6 +37,20 @@ in {
federation = {
ENABLED = true;
};
ui = {
DEFAULT_THEME = "catppuccin-mocha-lavender";
THEMES = builtins.concatStringsSep "," (
["auto,forgejo-auto,forgejo-dark,forgejo-light,arc-gree,gitea"]
++ (map (name: removePrefix "theme-" (removeSuffix ".css" name)) (
builtins.attrNames (builtins.readDir theme)
))
);
};
actions = {
ENABLED = true;
DEFAULT_ACTIONS_URL = "https://code.forgejo.org";
};
};
};
@ -39,6 +62,20 @@ in {
};
};
# https://github.com/isabelroses/dotfiles/blob/06f8f70914c8e672541a52563ee624ce2e62adfb/modules/nixos/services/selfhosted/forgejo.nix#L59-L71
systemd.services = {
forgejo = {
preStart = let
inherit (config.services.forgejo) stateDir;
in
mkAfter ''
rm -rf ${stateDir}/custom/public/assets
mkdir -p ${stateDir}/custom/public/assets
ln -sf ${theme} ${stateDir}/custom/public/assets/css
'';
};
};
networking.firewall = {
enable = true;
allowedTCPPorts = [80 443];