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