]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/chloe/default.nix
8e801b59b2d918d3357919ec9ff96163fe42c145
[perso/Immae/Config/Nix.git] / nixops / modules / websites / chloe / default.nix
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 services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps;
29 services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
30 services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
31 extension=${pkgs.php}/lib/php/extensions/mysqli.so
32 '';
33 system.activationScripts.chloe_prod = chloe_prod.activationScript;
34 system.extraSystemBuilderCmds = ''
35 mkdir -p $out/webapps
36 ln -s ${chloe_prod.app.webRoot} $out/webapps/${chloe_prod.apache.webappName}
37 '';
38 services.websites.production.modules = chloe_prod.apache.modules;
39 services.websites.production.vhostConfs.chloe = {
40 certName = "chloe";
41 certMainHost = "osteopathe-cc.fr";
42 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
43 root = chloe_prod.apache.root;
44 extraConfig = [ chloe_prod.apache.vhostConf ];
45 };
46 })
47 (lib.mkIf cfg.integration.enable {
48 secrets.keys = chloe_dev.keys;
49 services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps;
50 services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
51 services.myPhpfpm.poolPhpConfigs.chloe_dev = ''
52 extension=${pkgs.php}/lib/php/extensions/mysqli.so
53 '';
54 system.activationScripts.chloe_dev = chloe_dev.activationScript;
55 system.extraSystemBuilderCmds = ''
56 mkdir -p $out/webapps
57 ln -s ${chloe_dev.app.webRoot} $out/webapps/${chloe_dev.apache.webappName}
58 '';
59 services.websites.integration.modules = chloe_dev.apache.modules;
60 services.websites.integration.vhostConfs.chloe = {
61 certName = "eldiron";
62 addToCerts = true;
63 hosts = ["chloe.immae.eu" ];
64 root = chloe_dev.apache.root;
65 extraConfig = [ chloe_dev.apache.vhostConf ];
66 };
67 })
68 ];
69 }