{ pkgs, config, ... }: let hostname = "new.hackens.org"; #config.my.subZone; debug = false; #config.my.debug; in { imports = [ modules/custom-dokuwiki.nix ]; disabledModules = [ "services/web-apps/dokuwiki.nix" ]; networking.firewall.allowedTCPPorts = [ 80 443 ]; services.nginx.virtualHosts."${hostname}" = { enableACME = true; forceSSL = true; }; services.dokuwiki.sites."${hostname}" = { enable = true; extraConfig = '' $conf['template'] = 'bootstrap3'; $conf['license'] = 'cc-by-sa'; $conf['title'] = 'hackEns'; $conf['start'] = 'accueil'; $conf['lang'] = 'fr'; $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['tpl']['bootstrap3']['showAddNewPage'] = 'logged'; $conf['tpl']['bootstrap3']['fluidContainer'] = 0; $conf['htmlmail'] = 0; // On envoie les mails en plain text $conf['authtype'] = 'oauth'; $conf['plugin']['oauthkeycloak']['key'] = 'wiki'; $conf['plugin']['oauthkeycloak']['secret'] = ''; $conf['plugin']['oauthkeycloak']['openidurl'] = 'https://auth.rz.ens.wtf/auth/realms/hackENS/.well-known/openid-configuration/'; ''; pluginsConfig = '' $plugins['authmysql'] = 0; $plugins['popularity'] = 0; $plugins['authpgsql'] = 0; $plugins['authpdo'] = 0; $plugins['authldap'] = 0; $plugins['oauthkeycloak'] = 1; ''; disableActions = "register"; superUser = "@admin"; aclUse = true; # Il faut packager les templates templates = let template-bootstrap3 = { version, logo, favicon, apple-touch-icon, dokuwikiPath }: pkgs.stdenv.mkDerivation { name = "bootstrap3"; # Download the theme from the dokuwiki site src = pkgs.fetchFromGitHub version; # We need unzip to build this package # buildInputs = [ pkgs.unzip ]; # Installing simply means copying all files to the output directory 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 echo " $out/doku_inc.php # Lien vers le dokuwiki ''; }; # And then pass this theme to the template list like this: in [ (template-bootstrap3 { version = { owner = "giterlizzi"; repo = "dokuwiki-template-bootstrap3"; rev="v2020-07-29"; sha256="05d6si1lci3a2pgd10iwpwrgl969y7gq4qsn5p1lbgxkraad17af"; }; logo = ./media/logo.png; favicon = ./media/favicon.ico; apple-touch-icon = ./media/logo.png; dokuwikiPath = "${config.services.dokuwiki.sites."${hostname}".finalPackage}/share/dokuwiki"; }) ]; plugins = [ (pkgs.stdenv.mkDerivation { name = "commonmark"; # Download the theme from the dokuwiki site src = pkgs.fetchzip { url = "https://github.com/clockoon/dokuwiki-plugin-commonmark/releases/download/v1.2.0/release.tar.gz"; sha256 = "10SVyqkbkwzF/m4aTHB/ssXJK5rjQbLxYOAFDKYOxTY="; }; # Installing simply means copying all files to the output directory installPhase = '' mkdir -p $out cp -R * $out/ ''; }) (pkgs.stdenv.mkDerivation { name = "catlist"; # Download the theme from the dokuwiki site src = pkgs.fetchFromGitHub { owner = "xif-fr"; repo = "dokuwiki-plugin-catlist"; rev = "065f8d2f4817409989b9342b901163452fb9f547"; sha256 = "1l7bvnqkai8qkqqb67w8yy7fbs30dviqc36pyqggzfjhi558i9ih"; }; # Installing simply means copying all files to the output directory installPhase = '' mkdir -p $out cp -R * $out/ ''; }) (pkgs.stdenv.mkDerivation { name = "oauth"; # Download the theme from the dokuwiki site src = pkgs.fetchFromGitHub { owner = "cosmocode"; repo = "dokuwiki-plugin-oauth"; rev = "2022-01-13"; sha256 = "ruaw8MqSMgopULD7vxed44nbowjVc1e4H0Q7JEL9pD0="; }; # Installing simply means copying all files to the output directory installPhase = '' mkdir -p $out cp -R * $out/ ''; }) (pkgs.stdenv.mkDerivation { name = "oauthkeycloak"; # Download the theme from the dokuwiki site src = pkgs.fetchFromGitHub { owner = "YoitoFes"; repo = "dokuwiki-plugin-oauthkeycloak"; rev = "2022-12-23"; sha256 = "jV4CCVJ+4vbWE52ocsJnHR5oIM5ZM/5aYub6wxkVado="; }; # Installing simply means copying all files to the output directory installPhase = '' mkdir -p $out cp -R * $out/ ''; }) ]; }; # On veut php-xml services.phpfpm.pools."dokuwiki-${hostname}".phpPackage = pkgs.lib.mkForce ( pkgs.php74.withExtensions ( { all, enabled, ... }: enabled ++ [ all.xml ] )); }