This week I have decided to start running a Forgejo instance. The setup is painless with the help of NixOS modules, but I stuggled a bit to configure customizations on it.
According to Forgejo's documentation on interface
customization,
serving custom public files is just a matter of putting them on
$FORGEJO_CUSTOM/public/
. Thankfully, there's a NixOS option for this
directory: services.forgejo.customDir
. In order to customize your
interface, you just need to do this:
systemd.tmpfiles.rules =
let
cfg = config.services.forgejo;
img = ./img;
in [
"d '${cfg.customDir}/public' 0750 ${cfg.user} ${cfg.group} - -"
"d '${cfg.customDir}/public/assets' 0750 ${cfg.user} ${cfg.group} - -"
"d '${cfg.customDir}/public/assets/img' 0750 ${cfg.user} ${cfg.group} - -"
"L+ '${cfg.customDir}/public/assets/img/logo.svg' - - - - ${img}/logo.svg"
"L+ '${cfg.customDir}/public/assets/img/logo.png' - - - - ${img}/logo.png"
"L+ '${cfg.customDir}/public/assets/img/apple-touch-icon' - - - - ${img}/logo.png"
"L+ '${cfg.customDir}/public/assets/img/favicon.svg' - - - - ${img}/favicon.svg"
"L+ '${cfg.customDir}/public/assets/img/favicon.png' - - - - ${img}/favicon.png"
];