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, ... }:
let
hostname = "hackens.ens.fr";
hostname = "new.hackens.org" #config.my.subZone;
debug = true; #config.my.debug;
in
{
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}" = {
enable = true;
@ -27,7 +31,6 @@ in
$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
$conf['allowdebug'] = 1;
'';
pluginsConfig = ''
@ -45,7 +48,7 @@ in
# Il faut packager les templates
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";
# Download the theme from the dokuwiki site
src = pkgs.fetchFromGitHub version;
@ -61,7 +64,7 @@ in
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
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:
@ -77,15 +80,15 @@ in
logo = ./media/logo.png;
favicon = ./media/favicon.ico;
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";
})
];
};
# On veut php-xml
services.phpfpm.pools."dokuwiki-${hostname}".phpPackage = pkgs.lib.mkForce ( pkgs.php74.withExtensions (
services.phpfpm.pools."dokuwiki-${hostname}".phpPackage = pkgs.lib.mkForce ( pkgs.php74.withExtensions (
{ all, enabled, ... }:
enabled ++ [
all.xml
]
enabled ++ [
all.xml
]
));
}