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