hackens-org-configurations/hosts/hackens-org/wiki.nix

86 lines
2.7 KiB
Nix
Raw Normal View History

{ pkgs, ... }:
2022-03-17 00:05:23 +01:00
let
hostname = "hackens.ens.fr";
in
{
2021-12-14 19:39:11 +01:00
networking.firewall.allowedTCPPorts = [ 80 443 ];
2021-12-14 19:33:04 +01:00
# TODO: move to hackens.org
2022-03-17 00:05:23 +01:00
services.dokuwiki.sites."${hostname}" = {
enable = true;
extraConfig = ''
$conf['title'] = 'hackEns';
$conf['start'] = 'accueil';
$conf['lang'] = 'fr';
$conf['template'] = 'bootstrap3';
$conf['license'] = 'cc-by-sa';
$conf['breadcrumbs'] = 0; # On s'en fiche de l'historique des pages visitées
$conf['youarehere'] = true; # Par contre on veut notre position dans la hiérarchie du site
# On veut que les liens externes s'ouvrent dans de nouveaux onglets
$conf['target'] = array(
'extern' => '_tab'
);
$conf['htmlok'] = 1; # On peut mettre du html dans les pages
$conf['sitemap'] = 7;
$conf['rss_type'] = 'rss2';
$conf['userewrite'] = 1; # Important, sinon on casse tout avec les règles nginx définies par le module nixos
$conf['useslash'] = 1;
$conf['plugin']['tokenbucketauth']['tba_send_mail'] = 'hackens@clipper.ens.fr'; # Ban auto des IPs qui brute-forcent
$conf['htmlmail'] = 0; # On envoie les mails en plain text
'';
pluginsConfig = ''
$plugins['authmysql'] = 0;
$plugins['popularity'] = 0;
$plugins['authpgsql'] = 0;
$plugins['authpdo'] = 0;
$plugins['authldap'] = 0;
'';
disableActions = "register";
superUser = "@admin";
2022-03-13 12:08:33 +01:00
acluse = true;
# Il faut packager les templates
templates = let
2022-03-13 12:08:33 +01:00
template-bootstrap3 = { logo, favicon, apple-touch-icon }: pkgs.stdenv.mkDerivation {
name = "bootstrap3";
# Download the theme from the dokuwiki site
2022-03-13 12:08:33 +01:00
src = fetchFromGitHub {
owner = "giterlizzi";
repo = "dokuwiki-template-bootstrap3";
rev="v2021-03-11";
};
# We need unzip to build this package
buildInputs = [ pkgs.unzip ];
# Installing simply means copying all files to the output directory
2022-03-13 12:08:33 +01:00
installPhase = ''
mkdir -p $out
cp -R * $out/
rm $out/images/logo.png
rm $out/images/favicon.ico
rm $out/images/apple-touch-icon.png
ln -s ${logo} $out/images/logo.png
ln -s ${favicon} $out/images/favicon.ico
ln -s ${apple-touch-icon} $out/images/apple-touch-icon.png
'';
};
# And then pass this theme to the template list like this:
2022-03-13 12:08:33 +01:00
in [
template-bootstrap3 {
2022-03-17 00:05:23 +01:00
logo = ./media/logo.png;
favicon = ./media/favicon.ico;
apple-touch-icon = ./media/logo.png;
2022-03-13 12:08:33 +01:00
}
];
};
2022-03-17 00:05:23 +01:00
# On veut php-xml
services.phpfpm.pools."dokuwiki-${hostname}".phpPackage = pkgs.php74.withExtensions(
{ all, ... }:
[
all.xml
];
);
}