Essai de fix le template mais tjrs cassé

This commit is contained in:
Maurice Debray 2022-03-28 16:49:30 +02:00
parent 0d171f8026
commit deffeb3ef5

View file

@ -1,4 +1,4 @@
{ pkgs, ... }: { pkgs, config, ... }:
let let
hostname = "hackens.ens.fr"; hostname = "hackens.ens.fr";
in in
@ -9,24 +9,25 @@ in
enable = true; enable = true;
extraConfig = '' extraConfig = ''
$conf['template'] = 'dokuwiki';
$conf['license'] = 'cc-by-sa';
$conf['title'] = 'hackEns'; $conf['title'] = 'hackEns';
$conf['start'] = 'accueil'; $conf['start'] = 'accueil';
$conf['lang'] = 'fr'; $conf['lang'] = 'fr';
$conf['template'] = 'bootstrap3'; $conf['breadcrumbs'] = 0; // On s'en fiche de l'historique des pages visitées
$conf['license'] = 'cc-by-sa'; $conf['youarehere'] = true; // Par contre on veut notre position dans la hiérarchie du site
$conf['breadcrumbs'] = 0; # On s'en fiche de l'historique des pages visitées // On veut que les liens externes s'ouvrent dans de nouveaux onglets
$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( $conf['target'] = array(
'extern' => '_tab' 'extern' => '_tab'
); );
$conf['htmlok'] = 1; # On peut mettre du html dans les pages $conf['htmlok'] = 1; // On peut mettre du html dans les pages
$conf['sitemap'] = 7; $conf['sitemap'] = 7;
$conf['rss_type'] = 'rss2'; $conf['rss_type'] = 'rss2';
$conf['userewrite'] = 1; # Important, sinon on casse tout avec les règles nginx définies par le module nixos $conf['userewrite'] = 1; // Important, sinon on casse tout avec les règles nginx définies par le module nixos
$conf['useslash'] = 1; $conf['useslash'] = 1;
$conf['plugin']['tokenbucketauth']['tba_send_mail'] = 'hackens@clipper.ens.fr'; # Ban auto des IPs qui brute-forcent $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 $conf['htmlmail'] = 0; // On envoie les mails en plain text
$conf['allowdebug'] = 1;
''; '';
pluginsConfig = '' pluginsConfig = ''
@ -40,46 +41,51 @@ in
disableActions = "register"; disableActions = "register";
superUser = "@admin"; superUser = "@admin";
acluse = true; aclUse = true;
# Il faut packager les templates # Il faut packager les templates
templates = let templates = let
template-bootstrap3 = { logo, favicon, apple-touch-icon }: pkgs.stdenv.mkDerivation { template-bootstrap3 = { version, logo, favicon, apple-touch-icon, dokuwikiPkgs }: pkgs.stdenv.mkDerivation {
name = "bootstrap3"; name = "bootstrap3";
# Download the theme from the dokuwiki site # Download the theme from the dokuwiki site
src = fetchFromGitHub { src = pkgs.fetchFromGitHub version;
owner = "giterlizzi"; # We need unzip to build this package
repo = "dokuwiki-template-bootstrap3"; # buildInputs = [ pkgs.unzip ];
rev="v2021-03-11"; # 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 "<?php define('DOKU_INC', '${dokuwikiPkgs}/share/dokuwiki/');" > $out/doku_inc.php # Lien vers le dokuwiki
'';
}; };
# 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
'';
};
# And then pass this theme to the template list like this: # And then pass this theme to the template list like this:
in [ in [
template-bootstrap3 { (template-bootstrap3 {
version = {
owner = "giterlizzi";
repo = "dokuwiki-template-bootstrap3";
rev="v2020-07-29";
#sha256="0cwi7hi59s8p4wfgday2kcj42i1v0hh3f96rnmm1qi6scbb002hi";
sha256="05d6si1lci3a2pgd10iwpwrgl969y7gq4qsn5p1lbgxkraad17af";
};
logo = ./media/logo.png; logo = ./media/logo.png;
favicon = ./media/favicon.ico; favicon = ./media/favicon.ico;
apple-touch-icon = ./media/logo.png; apple-touch-icon = ./media/logo.png;
} dokuwikiPkgs = config.services.dokuwiki.sites."${hostname}".package; # Erreur, ce n'est pas le bon package
})
]; ];
}; };
# On veut php-xml # On veut php-xml
services.phpfpm.pools."dokuwiki-${hostname}".phpPackage = pkgs.php74.withExtensions( services.phpfpm.pools."dokuwiki-${hostname}".phpPackage = pkgs.lib.mkForce ( pkgs.php74.withExtensions (
{ all, ... }: { all, enabled, ... }:
[ enabled ++ [
all.xml all.xml
]; ]
); ));
} }