add dokuwiki
Some checks failed
Test Nix flake / Test nix flake (push) Has been cancelled

This commit is contained in:
XenGi 2026-11-28 01:10:50 +01:00
commit d1079715fc
Signed by: xengi
SSH key fingerprint: SHA256:jxWM2RTHvxxcncXycwwWkP7HCWb4VREN05UGJTbIPZg
3 changed files with 171 additions and 0 deletions

View file

@ -67,6 +67,13 @@
./hosts/md
];
};
wiki2 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
agenix.nixosModules.default
./hosts/wiki2
];
};
www = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [

36
hosts/wiki2/default.nix Normal file
View file

@ -0,0 +1,36 @@
{ ... }:
{
imports = [
../common.nix
../../services/openssh.nix
../../services/prometheus-node.nix
./dokuwiki.nix
];
networking = {
hostName = "wiki2";
firewall = {
allowedTCPPorts = [
80 # HTTP/1
443 # HTTP/2
];
allowedUDPPorts = [
443 # HTTP/3
];
};
};
environment.etc."ssh/banner".text = ''
__
__/\ \ __
__ __ __/\_\ \ \/'\ /\_\
/\ \/\ \/\ \/\ \ \ , < \/\ \
\ \ \_/ \_/ \ \ \ \ \\`\\ \ \
\ \___x___/'\ \_\ \_\ \_\ \_\
\/__//__/ \/_/\/_/\/_/\/_/
'';
services.openssh.settings.Banner = "/etc/ssh/banner";
system.stateVersion = "26.05";
}

128
hosts/wiki2/dokuwiki.nix Normal file
View file

@ -0,0 +1,128 @@
{ pkgs, config, ... }:
let
fqdn = "wiki2.${config.networking.domain}";
vector = pkgs.stdenv.mkDerivation rec {
name = "vector";
version = "2014-02-09";
src = pkgs.fetchFromGitHub {
owner = "foundata";
repo = "dokuwiki-template-vector";
rev = "9eec2c620de988bb0750565b784bb8f4d50d2faa";
hash = "";
};
installPhase = "mkdir -p $out; cp -R * $out/";
};
in
{
imports = [
../../services/nginx.nix
../../services/prometheus-nginx.nix
];
services = {
dokuwiki = {
webserver = "nginx";
sites.${fqdn} = {
acl = [
{
page = "*";
actor = "@ALL";
level = "read";
}
{
page = "*";
actor = "@users";
level = "read";
}
{
page = "*";
actor = "@member";
level = "upload";
}
{
page = "intern:*";
actor = "@ALL";
level = "none";
}
{
page = "intern:*";
actor = "@member";
level = "upload";
}
];
templates = [
#vector
];
plugins = [];
settings = {
# Basic Settings
title = "Chaos Computer Club Berlin";
lang = "de";
syntax = "md";
tagline = ""; # text under title
license = "cc-by-nc-sa";
basedir = "/";
baseurl = "https://${fqdn}";
# Display Settings
typography = 2;
dformat = "%Y-%m-%d %H:%M:%S %Z (%f)";
signature = "--- //[@NAME@](user:@USER@) @DATE@//";
showuseras = "username_link";
# Authentication Settings
useacl = true;
autopasswd = false;
authtype = "authplain";
passcrypt = "argon2id";
defaultgroup = "user";
superuser = "@admin";
manager = "@manager";
samesitecookie = "Strict";
remote = false;
remoteuser = "@admin";
remotecors = "https://${fqdn}";
# Anti-Spam Settings
usewordblock = true;
relnofollow = true;
mailguard = "hex";
# Media Settings
im_convert = "${pkgs.imagemagick}/bin/convert";
jpg_quality = 100;
# Notification Settings
subscribers = true;
registernotify = "admin@berlin.ccc.de";
mailfrom = "cccb wiki <noreply@berlin.ccc.de>";
mailprefix = "CCCB-WIKI";
# Syndication Settings
rss_type = "rss2";
# Advanced options
updatecheck = false;
fnencode = "utf-8";
#xsendfile = 3; # https://www.dokuwiki.org/install:nginx#x-accel-redirect
# Network Settings
jquerycdn = "0";
};
};
};
nginx.virtualHosts.${fqdn} = {
default = true;
quic = true;
kTLS = true;
forceSSL = true;
enableACME = true;
extraConfig = ''
proxy_set_header Forwarded "$proxy_forwarded_for_element;$proxy_forwarded_by_element;host=$host;proto=$scheme";
error_log syslog:server=unix:/dev/log,tag=${builtins.replaceStrings [ "." ] [ "_" ] fqdn} warn;
access_log syslog:server=unix:/dev/log vhost_combined;
'';
locations."/" = {
proxyPass = "http://${cfg.host}:${toString cfg.port}";
recommendedProxySettings = true;
extraConfig = ''
add_header Content-Security-Policy "frame-src 'self'; default-src 'self'; script-src 'self'; img-src 'self'; style-src 'self' 'unsafe-inline'; font-src 'self'; form-action 'self'; upgrade-insecure-requests;" always;
'';
};
};
};
}