mirror of
https://github.com/Mic92/nixos-wiki-infra.git
synced 2024-11-25 01:33:34 +01:00
expose sitemap
This commit is contained in:
parent
981901e8ff
commit
6078636f97
@ -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
|
||||
{
|
||||
|
@ -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";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
16
modules/nixos-wiki/mediawiki-maintenance.nix
Normal file
16
modules/nixos-wiki/mediawiki-maintenance.nix
Normal 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
|
||||
''
|
Loading…
Reference in New Issue
Block a user