-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(nixos): add support for gitea/forgejo
- Loading branch information
1 parent
8eada39
commit 46c4804
Showing
6 changed files
with
116 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[ | ||
./fcitx5.nix | ||
./gitea.nix | ||
./grub.nix | ||
./plymouth.nix | ||
./sddm.nix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ catppuccinLib }: | ||
{ | ||
lib, | ||
config, | ||
... | ||
}: | ||
let | ||
inherit (config.catppuccin) sources; | ||
|
||
supportedForges = [ | ||
"gitea" | ||
"forgejo" | ||
]; | ||
|
||
builtinThemes = { | ||
gitea = [ | ||
"auto" | ||
"gitea" | ||
"arc-greeen" | ||
]; | ||
|
||
forgejo = [ | ||
"forgejo-auto" | ||
"forgejo-light" | ||
"forgejo-dark" | ||
"gitea-auto" | ||
"gitea-light" | ||
"gitea-dark" | ||
"forgejo-auto-deuteranopia-protanopia" | ||
"forgejo-light-deuteranopia-protanopia" | ||
"forgejo-dark-deuteranopia-protanopia" | ||
"forgejo-auto-tritanopia" | ||
"forgejo-light-tritanopia" | ||
"forgejo-dark-tritanopia" | ||
]; | ||
}; | ||
|
||
generateConfig = | ||
forge: | ||
let | ||
cfg = config.catppuccin.${forge}; | ||
in | ||
lib.mkIf cfg.enable { | ||
systemd.services.${forge}.preStart = | ||
let | ||
inherit (config.services.${forge}) customDir; | ||
|
||
baseDir = | ||
if lib.versionAtLeast config.services.${forge}.package.version "1.21.0" then | ||
"${customDir}/public/assets" | ||
else | ||
"${customDir}/public"; | ||
in | ||
lib.mkAfter '' | ||
rm -rf ${baseDir}/css | ||
mkdir -p ${baseDir} | ||
ln -sf ${sources.gitea} ${baseDir}/css | ||
''; | ||
|
||
services.${forge}.settings.ui = { | ||
DEFAULT_THEME = "catppuccin-${cfg.flavor}-${cfg.accent}"; | ||
THEMES = builtins.concatStringsSep "," ( | ||
builtinThemes.${forge} | ||
++ (lib.mapCartesianProduct ({ flavors, accents }: "catppuccin-${flavors}-${accents}") { | ||
inherit (catppuccinLib.consts) flavors accents; | ||
}) | ||
); | ||
}; | ||
}; | ||
in | ||
{ | ||
options.catppuccin = lib.genAttrs supportedForges ( | ||
name: | ||
catppuccinLib.mkCatppuccinOption { | ||
inherit name; | ||
accentSupport = true; | ||
} | ||
); | ||
|
||
config = lib.mkMerge (map generateConfig supportedForges); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ buildCatppuccinPort, fetchzip }: | ||
|
||
buildCatppuccinPort (finalAttrs: { | ||
pname = "gitea"; | ||
version = "0.4.1"; | ||
|
||
src = fetchzip { | ||
url = "https://github.com/catppuccin/gitea/releases/download/v${finalAttrs.version}/catppuccin-gitea.tar.gz"; | ||
sha256 = "sha256-14XqO1ZhhPS7VDBSzqW55kh6n5cFZGZmvRCtMEh8JPI="; | ||
stripRoot = false; | ||
}; | ||
|
||
dontCatppuccinInstall = true; | ||
|
||
installPhase = '' | ||
runHook preInstall | ||
mkdir -p $out | ||
mv * $out | ||
runHook postInstall | ||
''; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters