]>
Commit | Line | Data |
---|---|---|
8a964143 | 1 | { lib, pkgs, config, myconfig, ... }: |
3013caf1 | 2 | let |
1bd8b03e | 3 | aten_dev = pkgs.callPackage ./aten.nix { |
8f904d0d | 4 | inherit (pkgs.webapps) aten; |
1bd8b03e IB |
5 | config = myconfig.env.websites.aten.integration; |
6 | }; | |
7 | aten_prod = pkgs.callPackage ./aten.nix { | |
8f904d0d | 8 | inherit (pkgs.webapps) aten; |
1bd8b03e IB |
9 | config = myconfig.env.websites.aten.production; |
10 | }; | |
86f6924f | 11 | |
1bd8b03e | 12 | cfg = config.services.myWebsites.Aten; |
3013caf1 IB |
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 { | |
1a718805 | 25 | secrets.keys = aten_prod.keys; |
9eae2b47 | 26 | services.webstats.sites = [ { name = "aten.pro"; } ]; |
e4a945cd | 27 | |
3013caf1 IB |
28 | security.acme.certs."aten" = config.services.myCertificates.certConfig // { |
29 | domain = "aten.pro"; | |
30 | extraDomains = { | |
31 | "www.aten.pro" = null; | |
32 | }; | |
33 | }; | |
86f6924f | 34 | |
8eded9ec | 35 | services.myPhpfpm.preStart.aten_prod = aten_prod.phpFpm.preStart; |
a0c845b4 | 36 | services.myPhpfpm.serviceDependencies.aten_prod = aten_prod.phpFpm.serviceDeps; |
98584540 | 37 | services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool; |
86f6924f | 38 | system.activationScripts.aten_prod = aten_prod.activationScript; |
e5073add IB |
39 | system.extraSystemBuilderCmds = '' |
40 | mkdir -p $out/webapps | |
1bd8b03e | 41 | ln -s ${aten_prod.app.webRoot} $out/webapps/${aten_prod.apache.webappName} |
e5073add | 42 | ''; |
daf64e3f IB |
43 | services.websites.production.modules = aten_prod.apache.modules; |
44 | services.websites.production.vhostConfs.aten = { | |
f8bde3d6 IB |
45 | certName = "aten"; |
46 | hosts = [ "aten.pro" "www.aten.pro" ]; | |
7da3ceec | 47 | root = aten_prod.apache.root; |
f8bde3d6 IB |
48 | extraConfig = [ aten_prod.apache.vhostConf ]; |
49 | }; | |
3013caf1 IB |
50 | }) |
51 | (lib.mkIf cfg.integration.enable { | |
1a718805 | 52 | secrets.keys = aten_dev.keys; |
3013caf1 | 53 | security.acme.certs."eldiron".extraDomains."dev.aten.pro" = null; |
8eded9ec | 54 | services.myPhpfpm.preStart.aten_dev = aten_dev.phpFpm.preStart; |
a0c845b4 | 55 | services.myPhpfpm.serviceDependencies.aten_dev = aten_dev.phpFpm.serviceDeps; |
98584540 | 56 | services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool; |
86f6924f | 57 | system.activationScripts.aten_dev = aten_dev.activationScript; |
e5073add IB |
58 | system.extraSystemBuilderCmds = '' |
59 | mkdir -p $out/webapps | |
1bd8b03e | 60 | ln -s ${aten_dev.app.webRoot} $out/webapps/${aten_dev.apache.webappName} |
e5073add | 61 | ''; |
daf64e3f IB |
62 | services.websites.integration.modules = aten_dev.apache.modules; |
63 | services.websites.integration.vhostConfs.aten = { | |
f8bde3d6 IB |
64 | certName = "eldiron"; |
65 | hosts = [ "dev.aten.pro" ]; | |
e5073add | 66 | root = aten_dev.apache.root; |
f8bde3d6 IB |
67 | extraConfig = [ aten_dev.apache.vhostConf ]; |
68 | }; | |
3013caf1 IB |
69 | }) |
70 | ]; | |
71 | } | |
72 |