]>
Commit | Line | Data |
---|---|---|
9d90e7e2 | 1 | { lib, pkgs, config, myconfig, mylibs, ... }: |
3013caf1 | 2 | let |
33aa7e5c | 3 | aten = pkgs.callPackage ./aten.nix { inherit (mylibs) fetchedGitPrivate yarn2nixPackage; }; |
9d90e7e2 IB |
4 | aten_dev = aten { |
5 | config = myconfig.env.websites.aten.integration; | |
6 | }; | |
7 | aten_prod = aten { | |
8 | config = myconfig.env.websites.aten.production; | |
9 | }; | |
86f6924f | 10 | |
3013caf1 IB |
11 | cfg = config.services.myWebsites.Aten; |
12 | in { | |
13 | options.services.myWebsites.Aten = { | |
14 | production = { | |
15 | enable = lib.mkEnableOption "enable Aten's website in production"; | |
16 | }; | |
17 | integration = { | |
18 | enable = lib.mkEnableOption "enable Aten's website in integration"; | |
19 | }; | |
20 | }; | |
21 | ||
091ae734 IB |
22 | imports = [ |
23 | ../commons/stats.nix | |
24 | ]; | |
25 | ||
3013caf1 IB |
26 | config = lib.mkMerge [ |
27 | (lib.mkIf cfg.production.enable { | |
1a718805 | 28 | secrets.keys = aten_prod.keys; |
e4a945cd IB |
29 | services.myWebsites.commons.stats.enable = true; |
30 | services.myWebsites.commons.stats.sites = [ | |
b7ee93fc | 31 | { name = "aten.pro"; } |
e4a945cd IB |
32 | ]; |
33 | ||
3013caf1 IB |
34 | security.acme.certs."aten" = config.services.myCertificates.certConfig // { |
35 | domain = "aten.pro"; | |
36 | extraDomains = { | |
37 | "www.aten.pro" = null; | |
38 | }; | |
39 | }; | |
86f6924f | 40 | |
8eded9ec | 41 | services.myPhpfpm.preStart.aten_prod = aten_prod.phpFpm.preStart; |
a0c845b4 | 42 | services.myPhpfpm.serviceDependencies.aten_prod = aten_prod.phpFpm.serviceDeps; |
98584540 | 43 | services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool; |
86f6924f | 44 | system.activationScripts.aten_prod = aten_prod.activationScript; |
e5073add IB |
45 | system.extraSystemBuilderCmds = '' |
46 | mkdir -p $out/webapps | |
47 | ln -s ${aten_prod.webRoot} $out/webapps/${aten_prod.apache.webappName} | |
48 | ''; | |
42429ef0 | 49 | services.myWebsites.apacheConfig.aten_prod.modules = aten_prod.apache.modules; |
f8bde3d6 IB |
50 | services.myWebsites.production.modules = aten_prod.apache.modules; |
51 | services.myWebsites.production.vhostConfs.aten = { | |
52 | certName = "aten"; | |
53 | hosts = [ "aten.pro" "www.aten.pro" ]; | |
7da3ceec | 54 | root = aten_prod.apache.root; |
f8bde3d6 IB |
55 | extraConfig = [ aten_prod.apache.vhostConf ]; |
56 | }; | |
3013caf1 IB |
57 | }) |
58 | (lib.mkIf cfg.integration.enable { | |
1a718805 | 59 | secrets.keys = aten_dev.keys; |
3013caf1 | 60 | security.acme.certs."eldiron".extraDomains."dev.aten.pro" = null; |
8eded9ec | 61 | services.myPhpfpm.preStart.aten_dev = aten_dev.phpFpm.preStart; |
a0c845b4 | 62 | services.myPhpfpm.serviceDependencies.aten_dev = aten_dev.phpFpm.serviceDeps; |
98584540 | 63 | services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool; |
86f6924f | 64 | system.activationScripts.aten_dev = aten_dev.activationScript; |
e5073add IB |
65 | system.extraSystemBuilderCmds = '' |
66 | mkdir -p $out/webapps | |
67 | ln -s ${aten_dev.webRoot} $out/webapps/${aten_dev.apache.webappName} | |
68 | ''; | |
f8bde3d6 IB |
69 | services.myWebsites.integration.modules = aten_dev.apache.modules; |
70 | services.myWebsites.integration.vhostConfs.aten = { | |
71 | certName = "eldiron"; | |
72 | hosts = [ "dev.aten.pro" ]; | |
e5073add | 73 | root = aten_dev.apache.root; |
f8bde3d6 IB |
74 | extraConfig = [ aten_dev.apache.vhostConf ]; |
75 | }; | |
3013caf1 IB |
76 | }) |
77 | ]; | |
78 | } | |
79 |