Emitter: Switch to Forgejo

This commit is contained in:
fruchti 2023-12-03 11:44:46 +01:00
parent 131c18230a
commit c0baac0488
48 changed files with 19 additions and 17 deletions

View file

@ -1,7 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
imports = [ imports = [
./gitea.nix ./forgejo.nix
./tls_sni.nix ./tls_sni.nix
]; ];

View file

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View file

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -2,18 +2,17 @@
let let
domain = "git.25120.org"; domain = "git.25120.org";
giteaCustom = pkgs.callPackage ../packages/directory.nix { forgejoCustom = pkgs.callPackage ../packages/directory.nix {
name = "gitea-custom"; name = "forgejo-custom";
source = ./gitea-custom; source = ./forgejo-custom;
}; };
in in
{ {
services.gitea = { services.forgejo = {
enable = true; enable = true;
appName = "${domain}";
database = { database = {
type = "postgres"; type = "postgres";
passwordFile = "/secrets/gitea_db_password"; passwordFile = "/secrets/forgejo_db_password";
createDatabase = false; createDatabase = false;
}; };
repositoryRoot = "/data/git/repositories"; repositoryRoot = "/data/git/repositories";
@ -22,12 +21,13 @@ in
contentDir = "/data/git/data/lfs"; contentDir = "/data/git/data/lfs";
}; };
settings = let settings = let
python = pkgs.python311;
docutils = docutils =
pkgs.python310.withPackages (ps: with ps; [ python.withPackages (ps: with ps; [
docutils # Provides rendering of ReStructured Text files docutils # Provides rendering of ReStructured Text files
pygments # Provides syntax highlighting pygments # Provides syntax highlighting
]); ]);
nbconvert = pkgs.python310.withPackages (ps: with ps; [ nbconvert = python.withPackages (ps: with ps; [
jupyter jupyter
ipykernel ipykernel
nbconvert nbconvert
@ -41,7 +41,7 @@ in
input_file="$1" input_file="$1"
command="${nbconvert}/bin/jupyter nbconvert --stdout --to html --template basic" command="${nbconvert}/bin/jupyter nbconvert --stdout --to html --template basic"
cache_directory="${config.services.gitea.stateDir}/markup_cache/jupyter" cache_directory="${config.services.forgejo.stateDir}/markup_cache/jupyter"
max_cache_file_count="${toString max_cached_jupyter_notebooks}" max_cache_file_count="${toString max_cached_jupyter_notebooks}"
cache_file="$cache_directory/$(md5sum "$input_file" | cut -d' ' -f1)" cache_file="$cache_directory/$(md5sum "$input_file" | cut -d' ' -f1)"
@ -64,6 +64,7 @@ in
''; '';
in in
{ {
DEFAULT.APP_NAME = "${domain}";
server = { server = {
SSH_PORT = lib.head config.services.openssh.ports; SSH_PORT = lib.head config.services.openssh.ports;
ROOT_URL = "https://${domain}/"; ROOT_URL = "https://${domain}/";
@ -72,6 +73,7 @@ in
}; };
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
session.COOKIE_SECURE = true; session.COOKIE_SECURE = true;
UI.DEFAULT_THEME = "forgejo-auto";
"markup.restructuredtext" = { "markup.restructuredtext" = {
ENABLED = true; ENABLED = true;
FILE_EXTENSIONS = ".rst"; FILE_EXTENSIONS = ".rst";
@ -103,11 +105,11 @@ in
services.postgresql = { services.postgresql = {
enable = true; enable = true;
authentication = '' authentication = ''
local gitea all ident map=gitea-users local forgejo all ident map=forgejo-users
''; '';
# Map the gitea user to postgresql # Map the forgejo user to postgresql
identMap = '' identMap = ''
gitea-users gitea gitea forgejo-users forgejo forgejo
''; '';
}; };
@ -124,14 +126,14 @@ in
}; };
}; };
# users.users.gitea.extraGroups = [ "keys" ]; # users.users.forgejo.extraGroups = [ "keys" ];
systemd.services.gitea = { systemd.services.forgejo = {
serviceConfig = { serviceConfig = {
ReadOnlyPaths = [ "/secrets" ]; ReadOnlyPaths = [ "/secrets" ];
}; };
preStart = '' preStart = ''
cp -frT "${giteaCustom}/" "${config.services.gitea.stateDir}/custom/" cp -frT "${forgejoCustom}/" "${config.services.forgejo.stateDir}/custom/"
find "${config.services.gitea.stateDir}/custom/" -type d -exec chmod 0750 '{}' + -or -type f -exec chmod 0640 '{}' + find "${config.services.forgejo.stateDir}/custom/" -type d -exec chmod 0750 '{}' + -or -type f -exec chmod 0640 '{}' +
''; '';
}; };