ACME, refactorisation

This commit is contained in:
Maurice Debray 2022-03-31 11:36:08 +02:00
parent deffeb3ef5
commit b75803557d

View file

@ -1,10 +1,14 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
let let
hostname = "hackens.ens.fr"; hostname = "new.hackens.org" #config.my.subZone;
debug = true; #config.my.debug;
in in
{ {
networking.firewall.allowedTCPPorts = [ 80 443 ]; networking.firewall.allowedTCPPorts = [ 80 443 ];
# TODO: move to hackens.org services.nginx.virtualHosts."${hostname}".enableACME =
if debug
then false
else true;
services.dokuwiki.sites."${hostname}" = { services.dokuwiki.sites."${hostname}" = {
enable = true; enable = true;
@ -27,7 +31,6 @@ in
$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 = ''
@ -45,7 +48,7 @@ in
# Il faut packager les templates # Il faut packager les templates
templates = let templates = let
template-bootstrap3 = { version, logo, favicon, apple-touch-icon, dokuwikiPkgs }: pkgs.stdenv.mkDerivation { template-bootstrap3 = { version, logo, favicon, apple-touch-icon, dokuwikiPath }: pkgs.stdenv.mkDerivation {
name = "bootstrap3"; name = "bootstrap3";
# Download the theme from the dokuwiki site # Download the theme from the dokuwiki site
src = pkgs.fetchFromGitHub version; src = pkgs.fetchFromGitHub version;
@ -61,7 +64,7 @@ in
ln -s ${logo} $out/images/logo.png ln -s ${logo} $out/images/logo.png
ln -s ${favicon} $out/images/favicon.ico ln -s ${favicon} $out/images/favicon.ico
ln -s ${apple-touch-icon} $out/images/apple-touch-icon.png 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 echo "<?php define('DOKU_INC', '${dokuwikiPath}');" > $out/doku_inc.php # Lien vers le dokuwiki
''; '';
}; };
# And then pass this theme to the template list like this: # And then pass this theme to the template list like this:
@ -77,7 +80,7 @@ in
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 dokuwikiPath = "${config.services.dokuwiki.sites."${hostname}".package}/share/dokuwiki";
}) })
]; ];
}; };