# NixOS, Gitea/Forgejo, and Catppuccin => .. Up a Level I spent a couple hours today figuring out how to get the official Catppuccin[1] theme for Gitea[2] and Forgejo[3] integrated into my NixOS[4] environment. Originally, I had taken the user theme for Codeberg, tweaked and cleaned it up for my server, and then used that. But, I decided to go a little further and submitted a request to make it official. Someone then made an entirely new package and made it the official version[5]. After a little pouting, I decided that I'd rather have someone else maintain it so I can focus on other things. => /tags/catppuccin/ 1: /tags/catppuccin/ => /tags/gitea/ 2: /tags/gitea/ => /tags/forgejo/ 3: /tags/forgejo/ => /tags/nixos/ 4: /tags/nixos/ => https://github.com/catppuccin/gitea 5: https://github.com/catppuccin/gitea The first part was pulling it down. Originally, I thought I would grab it via the Nix flake, but that ended up being too difficult. After fumbling around, I came up with using `fetchzip` (which apparently does tarballs also) because the release files don't have a top-level directory (all the CSS are on the root). ```nix inputs @ { config, pkgs, lib, ... }: let theme = pkgs.fetchzip { url = "https://github.com/catppuccin/gitea/releases/download/v0.2.1/catppuccin-gitea.tar.gz"; sha256 = "sha256-HqVLW58lKPn81p3gTSjzkACHSBbmqPqeobAlJMubb8Y="; stripRoot = false; }; in {} ``` From there, I needed to set it up. There aren't a lot of good ways (that I've found) with setting up data structures for services on NixOS, so I set everything up in the preStart of the service. The stanza below gets all the files into the right place. ```nix systemd.services.gitea = { preStart = lib.mkAfter '' rm -rf ${config.services.gitea.stateDir}/custom/public mkdir -p ${config.services.gitea.stateDir}/custom/public ln -sf ${theme} ${config.services.gitea.stateDir}/custom/public/css ''; }; ``` The last bit is to tell Gitea about the themes. I considered writing them all down, but there are quite a few of them (four basic types plus accents for each one), so I decided to dynamically build the list from the input. ```nix services.gitea = { settings = { ui = { THEMES = builtins.concatStringsSep "," (["auto"] ++ (map (name: lib.removePrefix "theme-" (lib.removeSuffix ".css" name)) (builtins.attrNames (builtins.readDir theme)))); DEFAULT_THEME = "catppuccin-mocha-blue"; }; }; }; ``` Thanks to ottidmes from the `#nix:nixos.org` matrix room for all the help. In other news, I switched from Gitea to Forgejo on src.mfgames.com[6]. There wasn't a compelling reason other than I feel that I fit the philosophy more. I also disabled registrations on that server for now. If you want to send me an update, just use my contact page[7] and send directly. => https://src.mfgames.com/ 6: https://src.mfgames.com/ => /contact/ 7: /contact/ # Metadata Categories: => /categories/development/ Development Tags: => /tags/catppuccin/ Catppuccin => /tags/forgejo/ Forgejo => /tags/gitea/ Gitea => /tags/nixos/ NixOS # Footer Below are various useful links within this site and to related sites (not all have been converted over to Gemini). => /now/ Now => /contact/ Contact => /bio/ Biography => /bibliography/ Bibliography => /support/ Support => /fiction/ Fiction => //fedran.com/ Fedran => https://mfgames.com/ Coding => https://moonfire.us/ The Moonfires => /categories/ Categories => /tags/ Tags => /privacy/ Privacy => /colophon/ Colophon => /license/ License => https://lists.typewriter.press/subscription?f=RDQ6f3AFHXnX2o763d5TgUmaYP7N763gR6FjZyGUUFWhyRkpgZF9I35ySICDBEdFFtgG Mailing List => https://d.moonfire.us/blog/2023/05/13/nixos-gitea-forgejo-and-catppuccin/