diff options
author | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-22 09:57:40 +0100 |
---|---|---|
committer | Ismaël Bouya <ismael.bouya@normalesup.org> | 2019-01-22 09:57:40 +0100 |
commit | f8d3b61afcde127404a01027afce9c31a22d5706 (patch) | |
tree | ba9838b8f4f20c1a01584f36744c278a8cb568cd /virtual/modules | |
parent | a5365ec3d924a91abdd80c4f58d2158472788de9 (diff) | |
download | Nix-f8d3b61afcde127404a01027afce9c31a22d5706.tar.gz Nix-f8d3b61afcde127404a01027afce9c31a22d5706.tar.zst Nix-f8d3b61afcde127404a01027afce9c31a22d5706.zip |
Merge common functions in websites
Diffstat (limited to 'virtual/modules')
-rw-r--r-- | virtual/modules/websites/default.nix | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/virtual/modules/websites/default.nix b/virtual/modules/websites/default.nix index cfd1f86..f2f0be1 100644 --- a/virtual/modules/websites/default.nix +++ b/virtual/modules/websites/default.nix | |||
@@ -83,6 +83,8 @@ let | |||
83 | }); | 83 | }); |
84 | }; | 84 | }; |
85 | }; | 85 | }; |
86 | makeModules = cfg: pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules or []) cfg.apacheConfig); | ||
87 | makeExtraConfig = cfg: (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig)); | ||
86 | in | 88 | in |
87 | { | 89 | { |
88 | imports = [ | 90 | imports = [ |
@@ -283,16 +285,16 @@ in | |||
283 | }; | 285 | }; |
284 | 286 | ||
285 | services.httpdProd = makeService "production" config.services.myWebsites.production; | 287 | services.httpdProd = makeService "production" config.services.myWebsites.production; |
286 | services.myWebsites.production.modules = pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules or []) cfg.apacheConfig); | 288 | services.myWebsites.production.modules = makeModules cfg; |
287 | services.myWebsites.production.extraConfig = (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig)); | 289 | services.myWebsites.production.extraConfig = makeExtraConfig cfg; |
288 | 290 | ||
289 | services.httpdInte = makeService "integration" config.services.myWebsites.integration; | 291 | services.httpdInte = makeService "integration" config.services.myWebsites.integration; |
290 | services.myWebsites.integration.modules = pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules or []) cfg.apacheConfig); | 292 | services.myWebsites.integration.modules = makeModules cfg; |
291 | services.myWebsites.integration.extraConfig = (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig)); | 293 | services.myWebsites.integration.extraConfig = makeExtraConfig cfg; |
292 | 294 | ||
293 | services.httpdTools = makeService "tools" config.services.myWebsites.tools; | 295 | services.httpdTools = makeService "tools" config.services.myWebsites.tools; |
294 | services.myWebsites.tools.modules = pkgs.lib.lists.flatten (pkgs.lib.attrsets.mapAttrsToList (n: v: v.modules or []) cfg.apacheConfig); | 296 | services.myWebsites.tools.modules = makeModules cfg; |
295 | services.myWebsites.tools.extraConfig = (builtins.filter (x: x != null) (pkgs.lib.attrsets.mapAttrsToList (n: v: v.extraConfig or null) cfg.apacheConfig)) ++ | 297 | services.myWebsites.tools.extraConfig = makeExtraConfig cfg ++ |
296 | [ '' | 298 | [ '' |
297 | RedirectMatch ^/licen[cs]es?_et_tip(ping)?$ https://www.immae.eu/licences_et_tip.html | 299 | RedirectMatch ^/licen[cs]es?_et_tip(ping)?$ https://www.immae.eu/licences_et_tip.html |
298 | RedirectMatch ^/licen[cs]es?_and_tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html | 300 | RedirectMatch ^/licen[cs]es?_and_tip(ping)?$ https://www.immae.eu/licenses_and_tipping.html |