From f69e0c01557a7cd2c6f353f71126c4cd47ae344c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Isma=C3=ABl=20Bouya?= Date: Thu, 7 Apr 2022 13:39:30 +0200 Subject: [PATCH 1/1] Add kanboard for gebull --- modules/private/websites/default.nix | 3 +- .../private/websites/tools/kanboard/farm.nix | 85 ++++++++++++++----- 2 files changed, 64 insertions(+), 24 deletions(-) diff --git a/modules/private/websites/default.nix b/modules/private/websites/default.nix index 0918908..aba216c 100644 --- a/modules/private/websites/default.nix +++ b/modules/private/websites/default.nix @@ -212,7 +212,8 @@ in }; }; - myServices.tools.kanboard.farm.instances.tonnelle = null; + myServices.tools.kanboard.farm.instances.tonnelle = {}; + myServices.tools.kanboard.farm.instances.gebull = {}; myServices.websites = { bakeer.cloud.enable = true; capitaines.landing_pages.enable = true; diff --git a/modules/private/websites/tools/kanboard/farm.nix b/modules/private/websites/tools/kanboard/farm.nix index 7967c51..5e37292 100644 --- a/modules/private/websites/tools/kanboard/farm.nix +++ b/modules/private/websites/tools/kanboard/farm.nix @@ -16,6 +16,37 @@ let SetEnv MAIL_FROM "kanboard@tools.immae.eu" ''; + 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}" + + SetEnv DATA_DIR "${toVardir name}" + SetEnv MAIL_FROM "kanboard@tools.immae.eu" + + + DirectoryIndex index.php + AllowOverride All + Options FollowSymlinks + Require all granted + + + SetHandler "proxy:unix:${config.services.phpfpm.pools.kanboard_farm.socket}|fcgi://localhost" + + + + Require all denied + + '' + ]; + }; + }; + customVhosts = lib.foldl (o: n: o // n) {} (map toCustomVhost (builtins.attrNames cfg.instances)); phpPackage = pkgs.php74; in { @@ -24,7 +55,13 @@ 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 { @@ -78,28 +115,30 @@ in }; inherit phpPackage; }; - services.websites.env.tools.vhostConfs.kanboard = { - certName = "eldiron"; - addToCerts = true; - hosts = ["kanboard.immae.eu"]; - root = null; - extraConfig = [ - '' - - DirectoryIndex index.php - AllowOverride All - Options FollowSymlinks - Require all granted - - - SetHandler "proxy:unix:${config.services.phpfpm.pools.kanboard_farm.socket}|fcgi://localhost" - - - - Require all denied - + services.websites.env.tools.vhostConfs = { + kanboard = { + certName = "eldiron"; + addToCerts = true; + hosts = ["kanboard.immae.eu"]; + root = null; + extraConfig = [ '' - ] ++ builtins.attrValues cfg.vhosts; - }; + + DirectoryIndex index.php + AllowOverride All + Options FollowSymlinks + Require all granted + + + SetHandler "proxy:unix:${config.services.phpfpm.pools.kanboard_farm.socket}|fcgi://localhost" + + + + Require all denied + + '' + ] ++ builtins.attrValues cfg.vhosts; + }; + } // customVhosts; }; } -- 2.41.0