]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, myconfig, ... }: | |
2 | let | |
3 | chloe_dev = pkgs.callPackage ./chloe.nix { | |
4 | inherit (pkgs.webapps) chloe; | |
5 | config = myconfig.env.websites.chloe.integration; | |
6 | }; | |
7 | chloe_prod = pkgs.callPackage ./chloe.nix { | |
8 | inherit (pkgs.webapps) chloe; | |
9 | config = myconfig.env.websites.chloe.production; | |
10 | }; | |
11 | ||
12 | cfg = config.services.myWebsites.Chloe; | |
13 | in { | |
14 | options.services.myWebsites.Chloe = { | |
15 | production = { | |
16 | enable = lib.mkEnableOption "enable Chloe's website in production"; | |
17 | }; | |
18 | integration = { | |
19 | enable = lib.mkEnableOption "enable Chloe's website in integration"; | |
20 | }; | |
21 | }; | |
22 | ||
23 | config = lib.mkMerge [ | |
24 | (lib.mkIf cfg.production.enable { | |
25 | secrets.keys = chloe_prod.keys; | |
26 | services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ]; | |
27 | ||
28 | security.acme.certs."chloe" = config.services.myCertificates.certConfig // { | |
29 | domain = "osteopathe-cc.fr"; | |
30 | extraDomains = { | |
31 | "www.osteopathe-cc.fr" = null; | |
32 | }; | |
33 | }; | |
34 | ||
35 | services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps; | |
36 | services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool; | |
37 | services.myPhpfpm.poolPhpConfigs.chloe_prod = '' | |
38 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | |
39 | ''; | |
40 | system.activationScripts.chloe_prod = chloe_prod.activationScript; | |
41 | system.extraSystemBuilderCmds = '' | |
42 | mkdir -p $out/webapps | |
43 | ln -s ${chloe_prod.app.webRoot} $out/webapps/${chloe_prod.apache.webappName} | |
44 | ''; | |
45 | services.websites.production.modules = chloe_prod.apache.modules; | |
46 | services.websites.production.vhostConfs.chloe = { | |
47 | certName = "chloe"; | |
48 | hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ]; | |
49 | root = chloe_prod.apache.root; | |
50 | extraConfig = [ chloe_prod.apache.vhostConf ]; | |
51 | }; | |
52 | }) | |
53 | (lib.mkIf cfg.integration.enable { | |
54 | secrets.keys = chloe_dev.keys; | |
55 | security.acme.certs."eldiron".extraDomains."chloe.immae.eu" = null; | |
56 | services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps; | |
57 | services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool; | |
58 | services.myPhpfpm.poolPhpConfigs.chloe_dev = '' | |
59 | extension=${pkgs.php}/lib/php/extensions/mysqli.so | |
60 | ''; | |
61 | system.activationScripts.chloe_dev = chloe_dev.activationScript; | |
62 | system.extraSystemBuilderCmds = '' | |
63 | mkdir -p $out/webapps | |
64 | ln -s ${chloe_dev.app.webRoot} $out/webapps/${chloe_dev.apache.webappName} | |
65 | ''; | |
66 | services.websites.integration.modules = chloe_dev.apache.modules; | |
67 | services.websites.integration.vhostConfs.chloe = { | |
68 | certName = "eldiron"; | |
69 | hosts = ["chloe.immae.eu" ]; | |
70 | root = chloe_dev.apache.root; | |
71 | extraConfig = [ chloe_dev.apache.vhostConf ]; | |
72 | }; | |
73 | }) | |
74 | ]; | |
75 | } |