From c1887a3d0a4e415f1bb412dd0d069b8d77ec5621 Mon Sep 17 00:00:00 2001 From: Anthony Rodriguez Date: Tue, 3 Dec 2024 09:23:18 +0100 Subject: [PATCH] system/services/forgejo: add catppuccin --- system/services/forgejo.nix | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/system/services/forgejo.nix b/system/services/forgejo.nix index fca61b0..0f0f33d 100644 --- a/system/services/forgejo.nix +++ b/system/services/forgejo.nix @@ -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];