SetEnv MAIL_FROM "kanboard@tools.immae.eu"
</Location>
'';
+ 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));
phpPackage = pkgs.php74;
in
{
description = "Instances names for the kanboard Farm";
default = {};
type = lib.types.attrsOf (lib.types.submodule {
- options = {};
+ options = {
+ customHost = lib.mkOption {
+ description = "Custom host to use for the kanboard instance";
+ default = null;
+ type = lib.types.nullOr lib.types.str;
+ };
+ };
});
};
vhosts = lib.mkOption {
};
inherit phpPackage;
};
- services.websites.env.tools.vhostConfs.kanboard = {
- certName = "eldiron";
- addToCerts = true;
- hosts = ["kanboard.immae.eu"];
- root = null;
- extraConfig = [
- ''
- <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>
+ services.websites.env.tools.vhostConfs = {
+ kanboard = {
+ certName = "eldiron";
+ addToCerts = true;
+ hosts = ["kanboard.immae.eu"];
+ root = null;
+ extraConfig = [
''
- ] ++ builtins.attrValues cfg.vhosts;
- };
+ <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>
+ ''
+ ] ++ builtins.attrValues cfg.vhosts;
+ };
+ } // customVhosts;
};
}