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

166 lines
5.8 KiB
Nix
Raw Normal View History

{ pkgs, config, ... }:
2022-03-17 00:05:23 +01:00
let
2022-04-06 14:23:43 +02:00
hostname = "new.hackens.org"; #config.my.subZone;
2022-04-06 14:27:57 +02:00
debug = false; #config.my.debug;
2022-03-17 00:05:23 +01:00
in
{
2022-04-06 14:23:43 +02:00
imports = [
modules/custom-dokuwiki.nix
];
disabledModules = [ "services/web-apps/dokuwiki.nix" ];
2021-12-14 19:39:11 +01:00
networking.firewall.allowedTCPPorts = [ 80 443 ];
2022-04-13 01:41:22 +02:00
services.nginx.virtualHosts."${hostname}" = {
enableACME = true;
forceSSL = true;
};
2022-03-17 00:05:23 +01:00
services.dokuwiki.sites."${hostname}" = {
enable = true;
extraConfig = ''
2022-04-06 14:23:43 +02:00
$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
2022-04-20 13:00:46 +02:00
$conf['tpl']['bootstrap3']['showAddNewPage'] = 'logged';
$conf['tpl']['bootstrap3']['fluidContainer'] = 0;
$conf['htmlmail'] = 0; // On envoie les mails en plain text
2022-05-18 21:37:08 +02:00
$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;
2022-05-18 21:37:08 +02:00
$plugins['oauthkeycloak'] = 1;
'';
disableActions = "register";
superUser = "@admin";
aclUse = true;
# Il faut packager les templates
templates = let
2022-04-06 14:23:43 +02:00
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
2022-04-06 14:23:43 +02:00
echo "<?php define('DOKU_INC', getenv('DOKUWIKI_ROOT'));" > $out/doku_inc.php # Lien vers le dokuwiki
'';
};
# And then pass this theme to the template list like this:
2022-03-13 12:08:33 +01:00
in [
(template-bootstrap3 {
version = {
owner = "giterlizzi";
repo = "dokuwiki-template-bootstrap3";
rev="v2020-07-29";
sha256="05d6si1lci3a2pgd10iwpwrgl969y7gq4qsn5p1lbgxkraad17af";
};
2022-03-17 00:05:23 +01:00
logo = ./media/logo.png;
favicon = ./media/favicon.ico;
apple-touch-icon = ./media/logo.png;
2022-04-06 14:23:43 +02:00
dokuwikiPath = "${config.services.dokuwiki.sites."${hostname}".finalPackage}/share/dokuwiki";
})
2022-03-13 12:08:33 +01:00
];
2022-04-20 13:00:46 +02:00
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/
'';
})
2022-05-05 18:02:42 +02:00
(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/
'';
})
2022-05-18 21:37:08 +02:00
(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/
'';
})
2022-04-20 13:00:46 +02:00
];
};
2022-03-17 00:05:23 +01:00
# On veut php-xml
2022-03-31 11:36:08 +02:00
services.phpfpm.pools."dokuwiki-${hostname}".phpPackage = pkgs.lib.mkForce ( pkgs.php74.withExtensions (
{ all, enabled, ... }:
2022-03-31 11:36:08 +02:00
enabled ++ [
all.xml
]
));
}