diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-12-24 09:41:27 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2020-04-25 00:04:37 +0200 |
commit | df9651b6dadeee494aa0e19380533d6137655738 (patch) | |
tree | d6b95b19fe068d6ede894799ad94a733ed1f84ac | |
parent | feef29e97e20b6c4ff26361445761222510496d1 (diff) | |
download | NUR-df9651b6dadeee494aa0e19380533d6137655738.tar.gz NUR-df9651b6dadeee494aa0e19380533d6137655738.tar.zst NUR-df9651b6dadeee494aa0e19380533d6137655738.zip |
Add maison bbc website
-rw-r--r-- | modules/websites/default.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/websites/default.nix b/modules/websites/default.nix index 043fc6ec..6ba0d687 100644 --- a/modules/websites/default.nix +++ b/modules/websites/default.nix | |||
@@ -86,6 +86,17 @@ in | |||
86 | }; | 86 | }; |
87 | }; | 87 | }; |
88 | }; | 88 | }; |
89 | vhostNoSSLConfs = mkOption { | ||
90 | default = {}; | ||
91 | description = "List of no ssl vhosts to define for Apache"; | ||
92 | type = attrsOf (submodule { | ||
93 | options = { | ||
94 | hosts = mkOption { type = listOf string; }; | ||
95 | root = mkOption { type = nullOr path; }; | ||
96 | extraConfig = mkOption { type = listOf lines; default = []; }; | ||
97 | }; | ||
98 | }); | ||
99 | }; | ||
89 | vhostConfs = mkOption { | 100 | vhostConfs = mkOption { |
90 | default = {}; | 101 | default = {}; |
91 | description = "List of vhosts to define for Apache"; | 102 | description = "List of vhosts to define for Apache"; |
@@ -177,6 +188,15 @@ in | |||
177 | documentRoot = vhostConf.root; | 188 | documentRoot = vhostConf.root; |
178 | extraConfig = builtins.concatStringsSep "\n" vhostConf.extraConfig; | 189 | extraConfig = builtins.concatStringsSep "\n" vhostConf.extraConfig; |
179 | }; | 190 | }; |
191 | toVhostNoSSL = ips: vhostConf: { | ||
192 | enableSSL = false; | ||
193 | logFormat = "combinedVhost"; | ||
194 | listen = map (ip: { inherit ip; port = 80; }) ips; | ||
195 | hostName = builtins.head vhostConf.hosts; | ||
196 | serverAliases = builtins.tail vhostConf.hosts or []; | ||
197 | documentRoot = vhostConf.root; | ||
198 | extraConfig = builtins.concatStringsSep "\n" vhostConf.extraConfig; | ||
199 | }; | ||
180 | in attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair | 200 | in attrsets.mapAttrs' (name: icfg: attrsets.nameValuePair |
181 | icfg.httpdName (mkIf icfg.enable { | 201 | icfg.httpdName (mkIf icfg.enable { |
182 | enable = true; | 202 | enable = true; |
@@ -190,6 +210,7 @@ in | |||
190 | extraConfig = builtins.concatStringsSep "\n" icfg.extraConfig; | 210 | extraConfig = builtins.concatStringsSep "\n" icfg.extraConfig; |
191 | virtualHosts = [ (toVhost icfg.ips icfg.fallbackVhost) ] | 211 | virtualHosts = [ (toVhost icfg.ips icfg.fallbackVhost) ] |
192 | ++ optionals (icfg.nosslVhost.enable) [ (nosslVhost icfg.ips icfg.nosslVhost) ] | 212 | ++ optionals (icfg.nosslVhost.enable) [ (nosslVhost icfg.ips icfg.nosslVhost) ] |
213 | ++ (attrsets.mapAttrsToList (n: v: toVhostNoSSL icfg.ips v) icfg.vhostNoSSLConfs) | ||
193 | ++ (attrsets.mapAttrsToList (n: v: toVhost icfg.ips v) icfg.vhostConfs) | 214 | ++ (attrsets.mapAttrsToList (n: v: toVhost icfg.ips v) icfg.vhostConfs) |
194 | ++ [ (redirectVhost icfg.ips) ]; | 215 | ++ [ (redirectVhost icfg.ips) ]; |
195 | }) | 216 | }) |