mirror of
https://codeberg.org/polyteknisk-radiogruppe/the_prg_server_configuration.git
synced 2026-10-21 11:25:46 +02:00
Compare commits
No commits in common. "64b55201709ccd117eb7417f53cbe7becb67d739" and "387fb668b3d2fd32764608663417e6859ca6de8e" have entirely different histories.
64b5520170
...
387fb668b3
5 changed files with 2 additions and 138 deletions
|
|
@ -137,27 +137,11 @@ else
|
||||||
print_warn "Secrets directory not found: ${SECRETS_DIR}"
|
print_warn "Secrets directory not found: ${SECRETS_DIR}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Step 2.2: Sync styling directory (copy custom themes, templates, css etc.)
|
# Step 2.2: Sync system_scripts directory
|
||||||
STYLING_DIR="${SCRIPT_DIR}/../styling"
|
|
||||||
STYLING_TARGET="/etc/styling"
|
|
||||||
|
|
||||||
if [[ -d "$STYLING_DIR" ]]; then
|
|
||||||
print_info "Syncing styling to ${BOLD}${STYLING_TARGET}${RESET}..."
|
|
||||||
if sudo rsync -av --delete "${STYLING_DIR}/" "${STYLING_TARGET}/"; then
|
|
||||||
print_success "Styling synced"
|
|
||||||
else
|
|
||||||
print_error "Failed to sync styling"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
print_warn "Styling directory not found: ${STYLING_DIR}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Step 2.3: Sync system_scripts directory
|
|
||||||
SYSTEM_SCRIPT_DIR="${SCRIPT_DIR}/../system_scripts"
|
SYSTEM_SCRIPT_DIR="${SCRIPT_DIR}/../system_scripts"
|
||||||
SYSTEM_SCRIPT_TARGET="/etc/nixos/system_scripts"
|
SYSTEM_SCRIPT_TARGET="/etc/nixos/system_scripts"
|
||||||
|
|
||||||
if [[ -d "$SYSTEM_SCRIPT_DIR" ]]; then
|
if [[ -d "$SECRETS_DIR" ]]; then
|
||||||
print_info "Syncing system scripts to ${BOLD}${SYSTEM_SCRIPT_TARGET}${RESET}..."
|
print_info "Syncing system scripts to ${BOLD}${SYSTEM_SCRIPT_TARGET}${RESET}..."
|
||||||
if sudo rsync -av --delete "${SYSTEM_SCRIPT_DIR}/" "${SYSTEM_SCRIPT_TARGET}/"; then
|
if sudo rsync -av --delete "${SYSTEM_SCRIPT_DIR}/" "${SYSTEM_SCRIPT_TARGET}/"; then
|
||||||
print_success "System scripts synced"
|
print_success "System scripts synced"
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
{{/* Custom header content - inject custom fonts that apply to all themes */}}
|
|
||||||
<style>
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Maple Mono NF';
|
|
||||||
src: url('{{AppSubUrl}}/assets/fonts/MapleMonoNerd.ttf') format('truetype');
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-display: swap;
|
|
||||||
}
|
|
||||||
|
|
||||||
:root {
|
|
||||||
--fonts-monospace: 'Maple Mono NF' !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
code, pre, kbd, tt, samp, .ui code, .ui pre, .monospace {
|
|
||||||
font-family: 'Maple Mono NF', ui-monospace, SFMono-Regular, Menlo, Monaco, "Segoe UI Mono", Roboto Mono, "Courier New", monospace !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<!-- Load the custom theme CSS (served from $FORGEJO_CUSTOM/public/assets/css) -->
|
|
||||||
<link rel="stylesheet" href="{{AppSubUrl}}/assets/css/theme-custom.css">
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{{template "base/head" .}}
|
|
||||||
<div role="main" aria-label='{{if .IsSigned}}{{.Ctx.Locale.Tr "dashboard"}}{{else}}{{.Ctx.Locale.Tr "home"}}{{end}}' class="page-content home">
|
|
||||||
<div class="tw-mb-8 tw-px-8">
|
|
||||||
<div class="center">
|
|
||||||
<div class="hero">
|
|
||||||
<h1 class="ui icon header title">
|
|
||||||
Forgejo hosted on NixOS!
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{template "base/footer" .}}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Maple Mono NF';
|
|
||||||
src: url('/assets/fonts/MapleMonoNerd.ttf') format('truetype');
|
|
||||||
font-weight: normal;
|
|
||||||
font-style: normal;
|
|
||||||
font-display: swap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* import base Forgejo theme so we only override what we need */
|
|
||||||
@import "./theme-forgejo-auto.css";
|
|
||||||
|
|
||||||
:root {
|
|
||||||
/* prefer the Maple Mono Nerd Font for monospace usage */
|
|
||||||
--fonts-monospace: 'Maple Mono NF' !important;
|
|
||||||
}
|
|
||||||
|
|
@ -8,23 +8,6 @@
|
||||||
cfg = config.services.forgejo;
|
cfg = config.services.forgejo;
|
||||||
srv = cfg.settings.server;
|
srv = cfg.settings.server;
|
||||||
choose = paths: builtins.head (builtins.filter (p: builtins.pathExists p) paths);
|
choose = paths: builtins.head (builtins.filter (p: builtins.pathExists p) paths);
|
||||||
mapleZip = pkgs.fetchurl {
|
|
||||||
url = "https://github.com/subframe7536/maple-font/releases/download/v7.9/MapleMonoNormal-NF-unhinted.zip";
|
|
||||||
sha256 = "1j8bh8fzrnrj4348xj8l1jpbchbblhi2a7gryarf2mi88xr1yc3f";
|
|
||||||
};
|
|
||||||
|
|
||||||
# Add a runCommand that unpacks the downloaded zip and exposes a stable ttf path
|
|
||||||
mapleFonts = pkgs.runCommand "maple-fonts" {buildInputs = [pkgs.unzip];} ''
|
|
||||||
mkdir -p $out/tmp
|
|
||||||
unzip -q ${mapleZip} -d $out/tmp
|
|
||||||
f="$(find $out/tmp -type f -name '*.ttf' | head -n1)"
|
|
||||||
if [ -z "$f" ]; then
|
|
||||||
echo "no ttf found" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
mkdir -p $out/fonts
|
|
||||||
cp "$f" $out/fonts/MapleMonoNerd.ttf
|
|
||||||
'';
|
|
||||||
in {
|
in {
|
||||||
options.local = {
|
options.local = {
|
||||||
hostname = lib.mkOption {
|
hostname = lib.mkOption {
|
||||||
|
|
@ -84,9 +67,6 @@ in {
|
||||||
# Forgejo configuration
|
# Forgejo configuration
|
||||||
services.forgejo = {
|
services.forgejo = {
|
||||||
enable = true;
|
enable = true;
|
||||||
# Explicit custom directory where Forgejo will look for custom templates/assets
|
|
||||||
# Ensure this matches what systemd.tmpfiles will populate below.
|
|
||||||
customDir = "/var/lib/forgejo/custom";
|
|
||||||
database = {
|
database = {
|
||||||
createDatabase = false; # Database already created, DO NOT REMOVE THIS OR IT WILL DEFAULT INTO INTERNAL ONE
|
createDatabase = false; # Database already created, DO NOT REMOVE THIS OR IT WILL DEFAULT INTO INTERNAL ONE
|
||||||
type = "postgres";
|
type = "postgres";
|
||||||
|
|
@ -120,56 +100,6 @@ in {
|
||||||
# ENABLED = false;
|
# ENABLED = false;
|
||||||
# };
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
settings.ui = {
|
|
||||||
DEFAULT_THEME = "forgejo-auto";
|
|
||||||
THEMES = "forgejo-auto,forgejo-light,forgejo-dark";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
systemd.tmpfiles.rules = [
|
|
||||||
"d '${config.services.forgejo.customDir}/templates' - forgejo forgejo - -"
|
|
||||||
# create the custom/templates/custom folder so header.tmpl can live under templates/custom
|
|
||||||
"d '${config.services.forgejo.customDir}/templates/custom' - forgejo forgejo - -"
|
|
||||||
"d '${config.services.forgejo.customDir}/public' - forgejo forgejo - -"
|
|
||||||
"d '${config.services.forgejo.customDir}/public/assets' - forgejo forgejo - -"
|
|
||||||
# ensure fonts directory exists
|
|
||||||
"d '${config.services.forgejo.customDir}/public/assets/fonts' - forgejo forgejo - -"
|
|
||||||
# ensure css directory exists so we can place theme css
|
|
||||||
"d '${config.services.forgejo.customDir}/public/assets/css' - forgejo forgejo - -"
|
|
||||||
# install the TTF from the Nix store into the Forgejo customDir
|
|
||||||
"C+ '${config.services.forgejo.customDir}/public/assets/fonts/MapleMonoNerd.ttf' - forgejo forgejo - ${mapleFonts}/fonts/MapleMonoNerd.ttf"
|
|
||||||
"C+ '${config.services.forgejo.customDir}/templates/home.tmpl' - forgejo forgejo - ${
|
|
||||||
../styling/forgejo/home.tmpl
|
|
||||||
}"
|
|
||||||
# copy header.tmpl into templates/custom so we can inject custom CSS into the <head>
|
|
||||||
"C+ '${config.services.forgejo.customDir}/templates/custom/header.tmpl' - forgejo forgejo - ${
|
|
||||||
../styling/forgejo/header.tmpl
|
|
||||||
}"
|
|
||||||
# copy your theme CSS into the public assets so Forgejo serves it directly
|
|
||||||
"C+ '${config.services.forgejo.customDir}/public/assets/css/theme-custom.css' - forgejo forgejo - ${
|
|
||||||
../styling/forgejo/theme-custom.css
|
|
||||||
}"
|
|
||||||
];
|
|
||||||
|
|
||||||
# Fallback: one-shot systemd service to copy custom assets on activation (works even if tmpfiles isn't applied or for live testing)
|
|
||||||
systemd.services."forgejo-custom-files" = {
|
|
||||||
description = "Install Forgejo custom templates and assets into customDir";
|
|
||||||
after = [ "network.target" ];
|
|
||||||
serviceConfig = {
|
|
||||||
Type = "oneshot";
|
|
||||||
# Use bash -c to run a compact copy/install script that ensures dirs exist and files are owned by forgejo
|
|
||||||
ExecStart = ''${pkgs.bash}/bin/bash -c "set -eu; \
|
|
||||||
install -d -m0755 -o forgejo -g forgejo ${config.services.forgejo.customDir}/public/assets/fonts; \
|
|
||||||
install -d -m0755 -o forgejo -g forgejo ${config.services.forgejo.customDir}/public/assets/css; \
|
|
||||||
install -d -m0755 -o forgejo -g forgejo ${config.services.forgejo.customDir}/templates/custom; \
|
|
||||||
cp -a ${mapleFonts}/fonts/MapleMonoNerd.ttf ${config.services.forgejo.customDir}/public/assets/fonts/MapleMonoNerd.ttf; \
|
|
||||||
cp -a ${toString ../styling/forgejo/header.tmpl} ${config.services.forgejo.customDir}/templates/custom/header.tmpl; \
|
|
||||||
cp -a ${toString ../styling/forgejo/home.tmpl} ${config.services.forgejo.customDir}/templates/home.tmpl; \
|
|
||||||
cp -a ${toString ../styling/forgejo/theme-custom.css} ${config.services.forgejo.customDir}/public/assets/css/theme-custom.css; \
|
|
||||||
chown -R forgejo:forgejo ${config.services.forgejo.customDir}"'';
|
|
||||||
};
|
|
||||||
wantedBy = [ "multi-user.target" ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
# Open ports in the firewall.
|
# Open ports in the firewall.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue