expose sitemap

This commit is contained in:
Jörg Thalheim 2024-05-20 15:46:21 +02:00
parent 981901e8ff
commit 6078636f97
3 changed files with 37 additions and 10 deletions

View File

@ -2,16 +2,9 @@
let
wikiDump = "/var/lib/mediawiki/backup/wikidump.xml.zst";
mediawiki-maintenance = pkgs.runCommand "mediawiki-maintenance"
{
nativeBuildInputs = [ pkgs.makeWrapper ];
preferLocalBuild = true;
} ''
mkdir -p $out/bin
makeWrapper ${config.services.phpfpm.pools.mediawiki.phpPackage}/bin/php $out/bin/mediawiki-maintenance \
--set MEDIAWIKI_CONFIG ${config.services.phpfpm.pools.mediawiki.phpEnv.MEDIAWIKI_CONFIG} \
--add-flags ${config.services.mediawiki.finalPackage}/share/mediawiki/maintenance/run.php
'';
mediawiki-maintenance = pkgs.callPackage ./mediawiki-maintenance.nix {
inherit config;
};
wiki-backup = pkgs.writeShellApplication
{

View File

@ -1,6 +1,10 @@
{ config, pkgs, lib, ... }:
let
cfg = config.services.nixos-wiki;
mediawiki-maintenance = pkgs.callPackage ./mediawiki-maintenance.nix {
inherit config;
};
in
{
options = {
@ -162,6 +166,20 @@ in
locations."=/nixos.png".alias = ./nixos.png;
locations."=/favicon.ico".alias = ./favicon.ico;
locations."=/robots.txt".alias = ./robots.txt;
locations."/sitemap/".alias = "/var/lib/mediawiki-sitemap/";
};
};
systemd.tmpfiles.rules = [
"d 'var/lib/mediawiki-sitemap' 0750 mediawiki ${config.services.nginx.group} - -"
];
systemd.services.wiki-sitemap = {
startAt = "daily";
serviceConfig = {
ExecStart = "${mediawiki-maintenance}/bin/mediawiki-maintenance generateSitemap.php --fspath /var/lib/mediawiki-sitemap/ --server http://${config.services.nixos-wiki.hostname} --urlpath sitemap/";
User = "mediawiki";
Type = "oneshot";
};
};
}

View File

@ -0,0 +1,16 @@
{
runCommand,
makeWrapper,
config,
}:
runCommand "mediawiki-maintenance"
{
nativeBuildInputs = [ makeWrapper ];
preferLocalBuild = true;
}
''
mkdir -p $out/bin
makeWrapper ${config.services.phpfpm.pools.mediawiki.phpPackage}/bin/php $out/bin/mediawiki-maintenance \
--set MEDIAWIKI_CONFIG ${config.services.phpfpm.pools.mediawiki.phpEnv.MEDIAWIKI_CONFIG} \
--add-flags ${config.services.mediawiki.finalPackage}/share/mediawiki/maintenance/run.php
''