+ toCustomVhost = name: lib.optionalAttrs (cfg.instances."${name}".customHost != null) {
+ "kanboard_farm_${name}" = {
+ certName = "eldiron";
+ addToCerts = true;
+ hosts = [cfg.instances."${name}".customHost];
+ root = null;
+ extraConfig = [
+ ''
+ Alias / "${rootDir}"
+ <Location />
+ SetEnv DATA_DIR "${toVardir name}"
+ SetEnv MAIL_FROM "kanboard@tools.immae.eu"
+ </Location>
+ <Directory "${rootDir}">
+ DirectoryIndex index.php
+ AllowOverride All
+ Options FollowSymlinks
+ Require all granted
+
+ <FilesMatch "\.php$">
+ SetHandler "proxy:unix:${config.services.phpfpm.pools.kanboard_farm.socket}|fcgi://localhost"
+ </FilesMatch>
+ </Directory>
+ <DirectoryMatch "${rootDir}/data">
+ Require all denied
+ </DirectoryMatch>
+ ''
+ ];
+ };
+ };
+ customVhosts = lib.foldl (o: n: o // n) {} (map toCustomVhost (builtins.attrNames cfg.instances));