]>
Commit | Line | Data |
---|---|---|
1 | { lib, pkgs, config, myconfig, ... }: | |
2 | let | |
3 | aten_dev = pkgs.callPackage ./aten.nix { | |
4 | inherit (pkgs.webapps) aten; | |
5 | config = myconfig.env.websites.aten.integration; | |
6 | }; | |
7 | aten_prod = pkgs.callPackage ./aten.nix { | |
8 | inherit (pkgs.webapps) aten; | |
9 | config = myconfig.env.websites.aten.production; | |
10 | }; | |
11 | ||
12 | cfg = config.services.myWebsites.Aten; | |
13 | in { | |
14 | options.services.myWebsites.Aten = { | |
15 | production = { | |
16 | enable = lib.mkEnableOption "enable Aten's website in production"; | |
17 | }; | |
18 | integration = { | |
19 | enable = lib.mkEnableOption "enable Aten's website in integration"; | |
20 | }; | |
21 | }; | |
22 | ||
23 | config = lib.mkMerge [ | |
24 | (lib.mkIf cfg.production.enable { | |
25 | secrets.keys = aten_prod.keys; | |
26 | services.webstats.sites = [ { name = "aten.pro"; } ]; | |
27 | ||
28 | services.myPhpfpm.preStart.aten_prod = aten_prod.phpFpm.preStart; | |
29 | services.myPhpfpm.serviceDependencies.aten_prod = aten_prod.phpFpm.serviceDeps; | |
30 | services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool; | |
31 | system.activationScripts.aten_prod = aten_prod.activationScript; | |
32 | system.extraSystemBuilderCmds = '' | |
33 | mkdir -p $out/webapps | |
34 | ln -s ${aten_prod.app.webRoot} $out/webapps/${aten_prod.apache.webappName} | |
35 | ''; | |
36 | services.websites.production.modules = aten_prod.apache.modules; | |
37 | services.websites.production.vhostConfs.aten = { | |
38 | certName = "aten"; | |
39 | certMainHost = "aten.pro"; | |
40 | hosts = [ "aten.pro" "www.aten.pro" ]; | |
41 | root = aten_prod.apache.root; | |
42 | extraConfig = [ aten_prod.apache.vhostConf ]; | |
43 | }; | |
44 | }) | |
45 | (lib.mkIf cfg.integration.enable { | |
46 | secrets.keys = aten_dev.keys; | |
47 | services.myPhpfpm.preStart.aten_dev = aten_dev.phpFpm.preStart; | |
48 | services.myPhpfpm.serviceDependencies.aten_dev = aten_dev.phpFpm.serviceDeps; | |
49 | services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool; | |
50 | system.activationScripts.aten_dev = aten_dev.activationScript; | |
51 | system.extraSystemBuilderCmds = '' | |
52 | mkdir -p $out/webapps | |
53 | ln -s ${aten_dev.app.webRoot} $out/webapps/${aten_dev.apache.webappName} | |
54 | ''; | |
55 | services.websites.integration.modules = aten_dev.apache.modules; | |
56 | services.websites.integration.vhostConfs.aten = { | |
57 | certName = "eldiron"; | |
58 | addToCerts = true; | |
59 | hosts = [ "dev.aten.pro" ]; | |
60 | root = aten_dev.apache.root; | |
61 | extraConfig = [ aten_dev.apache.vhostConf ]; | |
62 | }; | |
63 | }) | |
64 | ]; | |
65 | } | |
66 |