2023-07-30 16:24:46 +02:00
|
|
|
{ pkgsOld, ... }:
|
2023-04-26 23:25:04 +02:00
|
|
|
{
|
|
|
|
containers."phtanumb-wiki" = {
|
|
|
|
autoStart = true;
|
2023-07-30 16:24:46 +02:00
|
|
|
privateNetwork = true;
|
|
|
|
hostAddress = "10.0.1.1";
|
|
|
|
localAddress = "10.0.1.2";
|
|
|
|
nixpkgs = pkgsOld.path;
|
2023-04-26 23:25:04 +02:00
|
|
|
bindMounts = {
|
|
|
|
"/var/mediawiki" = {
|
|
|
|
hostPath = "/phtanum-b/wiki";
|
|
|
|
isReadOnly = false;
|
|
|
|
};
|
|
|
|
};
|
2023-07-30 16:24:46 +02:00
|
|
|
# extraVeths = {
|
|
|
|
# "phtanumb" = {
|
|
|
|
# hostAddress = "10.0.1.1";
|
|
|
|
# localAddress = "10.0.1.2";
|
|
|
|
# };
|
|
|
|
# };
|
2023-04-26 23:25:04 +02:00
|
|
|
config = { config, pkgs, ... }: {
|
2023-05-04 16:23:54 +02:00
|
|
|
environment.systemPackages = with pkgs; [ luajit ];
|
2023-07-30 16:24:46 +02:00
|
|
|
networking.firewall.enable = false;
|
|
|
|
# networking.nameservers = [ "9.9.9.9" "149.112.112.112" ];
|
|
|
|
environment.etc."resolv.conf".text = "nameserver 9.9.9.9";
|
2023-04-26 23:25:04 +02:00
|
|
|
services.mediawiki = {
|
|
|
|
enable = true;
|
|
|
|
name = "phtanum-b";
|
2023-07-30 16:24:46 +02:00
|
|
|
virtualHost = {
|
|
|
|
hostName = "wiki.phtanum-b.katzen.cafe";
|
|
|
|
adminAddr = "admin@katzen.cafe";
|
|
|
|
listen = [
|
|
|
|
{
|
|
|
|
ip = "10.0.1.2";
|
|
|
|
port = 80;
|
|
|
|
ssl = false;
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
2023-04-26 23:25:04 +02:00
|
|
|
passwordFile = "/var/mediawiki/passwordFile";
|
|
|
|
extraConfig = ''
|
2023-05-03 00:01:02 +02:00
|
|
|
# $wgShowExceptionDetails = true;
|
|
|
|
# $wgDebugToolbar = true;
|
|
|
|
# $wgShowDebug = true;
|
|
|
|
# $wgDevelopmentWarnings = true;
|
|
|
|
|
2023-04-26 23:25:04 +02:00
|
|
|
# Disable anonymous editing
|
|
|
|
$wgGroupPermissions['*']['edit'] = false;
|
2023-05-03 00:01:02 +02:00
|
|
|
$wgGroupPermissions['oidc_editor']['edit'] = true;
|
|
|
|
$wgGroupPermissions['oidc_editor']['createpage'] = true;
|
|
|
|
|
2023-05-03 23:41:30 +02:00
|
|
|
$wgLogo = 'images/d/de/Phtanum-b-wikilogo.png';
|
|
|
|
|
2023-05-04 16:23:54 +02:00
|
|
|
$wgScribuntoDefaultEngine = 'luastandalone';
|
|
|
|
$wgScribuntoEngineConf['luastandalone']['luaPath'] = '${pkgs.luajit}/bin/lua';
|
|
|
|
|
|
|
|
$wgScribuntoUseGeSHi = true;
|
|
|
|
$wgScribuntoUseCodeEditor = true;
|
|
|
|
|
2023-05-03 00:01:02 +02:00
|
|
|
$wgGroupPermissions['oidc_interface_admin'] = $wgGroupPermissions['interface_admin'];
|
|
|
|
$wgGroupPermissions['oidc_admin'] = $wgGroupPermissions['sysop'];
|
|
|
|
$wgGroupPermissions['oidc_admin']['userrights'] = true;
|
|
|
|
|
2023-04-30 14:56:30 +02:00
|
|
|
$wgDebugLogFile = "/var/log/mediawiki/debug-{$wgDBname}.log";
|
2023-05-03 00:01:02 +02:00
|
|
|
|
|
|
|
$oidcClientSecret = file_get_contents('/var/mediawiki/keycloakClientSecret', false, null, 0, 32);
|
|
|
|
|
|
|
|
$wgPluggableAuth_Config[] = [
|
2023-04-30 14:56:30 +02:00
|
|
|
'plugin' => 'OpenIDConnect',
|
|
|
|
'data' => [
|
2023-05-03 00:01:02 +02:00
|
|
|
'providerURL' => 'https://auth.katzen.cafe/realms/phtanum-b',
|
2023-04-30 14:56:30 +02:00
|
|
|
'clientID' => 'phtanumb-wiki',
|
2023-05-03 00:01:02 +02:00
|
|
|
# hack to try dynamically get the secret
|
|
|
|
'clientsecret' => $oidcClientSecret,
|
|
|
|
'global_roles' => ['property' => ['realm_access', 'roles']],
|
|
|
|
'wiki_roles' => ['property' => ['resource_access', 'phtanumb-wiki', 'roles']]
|
2023-04-30 14:56:30 +02:00
|
|
|
]
|
|
|
|
];
|
2023-04-26 23:25:04 +02:00
|
|
|
'';
|
2023-04-30 14:56:30 +02:00
|
|
|
extensions = {
|
|
|
|
PluggableAuth = pkgs.fetchzip {
|
|
|
|
url = "https://extdist.wmflabs.org/dist/extensions/PluggableAuth-REL1_38-5331512.tar.gz";
|
|
|
|
sha256 = "sha256-OWfr3oq2XzyJ5tynP5bRRPm34ymqz2oIBe2vBPHK+/Q=";
|
|
|
|
};
|
|
|
|
OpenIDConnect = pkgs.fetchzip {
|
|
|
|
url = "https://extdist.wmflabs.org/dist/extensions/OpenIDConnect-REL1_38-8f8bab6.tar.gz";
|
|
|
|
sha256 = "sha256-g+PGNzt0o2FebI3xyVamz5RA95E86MD2yqD4v8N6zKU=";
|
|
|
|
};
|
2023-05-04 11:49:36 +02:00
|
|
|
TemplateStyles = pkgs.fetchzip {
|
|
|
|
url = "https://extdist.wmflabs.org/dist/extensions/TemplateStyles-REL1_38-a2d1ae3.tar.gz";
|
|
|
|
sha256 = "sha256-AFTfKP5McB/UikA9RRAmw1vLrb7zWjbBLtJhsEP9sTY=";
|
|
|
|
};
|
2023-05-04 17:10:27 +02:00
|
|
|
# this is cursed. why do the extensions 404???
|
|
|
|
#JsonConfig = pkgs.fetchzip {
|
|
|
|
#url = "https://extdist.wmflabs.org/dist/extensions/JsonConfig-REL1_39-9840e0b.tar.gz";
|
|
|
|
#sha256 = "sha256-m6JfUftyokJUauAg8SV8p1daUiOpFMvxNMa3el/RrJ0=";
|
2023-05-04 16:23:54 +02:00
|
|
|
#};
|
2023-05-04 17:10:27 +02:00
|
|
|
TemplateData = null;
|
2023-05-04 16:23:54 +02:00
|
|
|
Scribunto = null;
|
|
|
|
ParserFunctions = null;
|
2023-05-04 17:10:27 +02:00
|
|
|
#VisualEditor = null;
|
2023-05-04 16:23:54 +02:00
|
|
|
WikiEditor = null;
|
|
|
|
CodeEditor = null;
|
2023-04-30 14:56:30 +02:00
|
|
|
};
|
2023-04-26 23:25:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
system.stateVersion = "22.11";
|
|
|
|
};
|
|
|
|
};
|
2023-04-30 14:56:30 +02:00
|
|
|
deployment.keys = {
|
|
|
|
"passwordFile" = {
|
2023-05-03 00:01:02 +02:00
|
|
|
keyCommand = [ "cat" "/home/jade/keys-tmp/phtanumb-wiki-passwordFile" ];
|
2023-04-30 14:56:30 +02:00
|
|
|
destDir = "/phtanum-b/wiki";
|
|
|
|
};
|
|
|
|
"keycloakClientSecret" = {
|
|
|
|
keyCommand = [ "cat" "/home/jade/keys-tmp/phtanumb-wiki-keycloak-secret" ];
|
|
|
|
destDir = "/phtanum-b/wiki";
|
2023-05-03 00:01:02 +02:00
|
|
|
permissions = "0604";
|
2023-04-30 14:56:30 +02:00
|
|
|
};
|
2023-04-26 23:25:04 +02:00
|
|
|
};
|
|
|
|
}
|