treewide: note gitea theme names in passthru attr

This commit is contained in:
2025-04-05 21:29:26 +02:00
parent 3c12637718
commit db2e4becf1
5 changed files with 49 additions and 13 deletions
module.nix
themes
catppuccin
earl-grey
monokai
pitch-black

@ -18,7 +18,7 @@ in
services.gitea.settings.ui.THEMES = lib.strings.concatStringsSep "," ([ services.gitea.settings.ui.THEMES = lib.strings.concatStringsSep "," ([
"gitea" "gitea"
"arc-green" "arc-green"
] ++ lib.attrNames cfg); ] ++ (lib.concatMap (drv: drv.passthru.gitea-themes) (lib.attrValues cfg)));
systemd.services.install-gitea-themes = { systemd.services.install-gitea-themes = {
description = "Install gitea themes in gitea's CUSTOM_DIR"; description = "Install gitea themes in gitea's CUSTOM_DIR";

@ -1,5 +1,5 @@
{ { lib
deno , deno
, fetchzip , fetchzip
, stdenv , stdenv
}: }:
@ -18,11 +18,35 @@ stdenv.mkDerivation (finalAttrs: {
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
mkdir -p "$out/share/gitea/public/assets/css" mkdir -p "$out/share/gitea/public/assets/css"
mv *.css "$out/share/gitea/public/assets/css" mv *.css "$out/share/gitea/public/assets/css"
runHook postInstall runHook postInstall
''; '';
passthru.gitea-themes = (lib.mapCartesianProduct ({ variant, color }: "catppuccin-${variant}-${color}") {
variant = [
"frappe"
"latte"
];
color = [
"blue"
"flamingo"
"green"
"lavender"
"maroon"
"mauve"
"peach"
"pink"
"red"
"rosewater"
"sapphire"
"sky"
"teal"
"yellow"
];
}) ++ [
"catppuccin-blue-auto"
"catppuccin-flamingo-auto"
"catppuccin-green-auto"
"catppuccin-lavender-auto"
];
}) })

@ -1,7 +1,11 @@
{ runCommand { runCommand
}: }:
runCommand "gitea-earl-grey-theme" { (runCommand "gitea-earl-grey-theme" {
} '' } ''
install -D ${./theme-earl-grey.css} $out/share/gitea/public/assets/css/theme-earl-grey.css install -D ${./theme-earl-grey.css} $out/share/gitea/public/assets/css/theme-earl-grey.css
'' '').overrideAttrs(_: {
passthru.gitea-themes = [
"earl-grey"
];
})

@ -2,9 +2,13 @@
, lessc , lessc
}: }:
runCommand "gitea-monokai-theme" { (runCommand "gitea-monokai-theme" {
buildInputs = [ lessc ]; buildInputs = [ lessc ];
} '' } ''
mkdir $out mkdir $out
lessc ${./theme-monokai.less} $out/share/gitea/public/assets/css/theme-monokai.css lessc ${./theme-monokai.less} $out/share/gitea/public/assets/css/theme-monokai.css
'' '').overrideAttrs(_: {
passthru.gitea-themes = [
"monokai"
];
})

@ -3,11 +3,15 @@
, lessc , lessc
}: }:
runCommand "gitea-pitch-black-theme" { (runCommand "gitea-pitch-black-theme" {
nativeBuildInputs = [ lessc ]; nativeBuildInputs = [ lessc ];
} '' } ''
mkdir -p css/theme-pitch-black/ mkdir -p css/theme-pitch-black/
cp "${./theme-pitch-black.less}" css/theme-pitch-black/theme-pitch-black.less cp "${./theme-pitch-black.less}" css/theme-pitch-black/theme-pitch-black.less
ln -s ${gitea.src}/web_src/css/chroma css/chroma ln -s ${gitea.src}/web_src/css/chroma css/chroma
lessc css/theme-pitch-black/theme-pitch-black.less $out/share/gitea/public/assets/css/theme-pitch-black.css lessc css/theme-pitch-black/theme-pitch-black.less $out/share/gitea/public/assets/css/theme-pitch-black.css
'' '').overrideAttrs(_: {
passthru.gitea-themes = [
"pitch-black"
];
})