]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/chloe/default.nix
Remove direct dependency to myconfig in database modules
[perso/Immae/Config/Nix.git] / nixops / modules / websites / chloe / default.nix
CommitLineData
8a964143 1{ lib, pkgs, config, myconfig, ... }:
3013caf1 2let
7667c367 3 chloe_dev = pkgs.callPackage ./chloe.nix {
8f904d0d 4 inherit (pkgs.webapps) chloe;
7667c367
IB
5 config = myconfig.env.websites.chloe.integration;
6 };
7 chloe_prod = pkgs.callPackage ./chloe.nix {
8f904d0d 8 inherit (pkgs.webapps) chloe;
7667c367
IB
9 config = myconfig.env.websites.chloe.production;
10 };
86f6924f 11
7667c367 12 cfg = config.services.myWebsites.Chloe;
3013caf1
IB
13in {
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 {
1a718805 25 secrets.keys = chloe_prod.keys;
9eae2b47 26 services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ];
e4a945cd 27
906065a0 28 services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps;
98584540 29 services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
912921a7
IB
30 services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
31 extension=${pkgs.php}/lib/php/extensions/mysqli.so
32 '';
86f6924f 33 system.activationScripts.chloe_prod = chloe_prod.activationScript;
e5073add
IB
34 system.extraSystemBuilderCmds = ''
35 mkdir -p $out/webapps
7667c367 36 ln -s ${chloe_prod.app.webRoot} $out/webapps/${chloe_prod.apache.webappName}
e5073add 37 '';
daf64e3f
IB
38 services.websites.production.modules = chloe_prod.apache.modules;
39 services.websites.production.vhostConfs.chloe = {
7df420c2
IB
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 ];
f8bde3d6 45 };
3013caf1
IB
46 })
47 (lib.mkIf cfg.integration.enable {
1a718805 48 secrets.keys = chloe_dev.keys;
906065a0 49 services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps;
98584540 50 services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
62a0946e 51 services.myPhpfpm.poolPhpConfigs.chloe_dev = ''
912921a7
IB
52 extension=${pkgs.php}/lib/php/extensions/mysqli.so
53 '';
86f6924f 54 system.activationScripts.chloe_dev = chloe_dev.activationScript;
e5073add
IB
55 system.extraSystemBuilderCmds = ''
56 mkdir -p $out/webapps
7667c367 57 ln -s ${chloe_dev.app.webRoot} $out/webapps/${chloe_dev.apache.webappName}
e5073add 58 '';
daf64e3f
IB
59 services.websites.integration.modules = chloe_dev.apache.modules;
60 services.websites.integration.vhostConfs.chloe = {
f8bde3d6 61 certName = "eldiron";
7df420c2 62 addToCerts = true;
f8bde3d6 63 hosts = ["chloe.immae.eu" ];
e5073add 64 root = chloe_dev.apache.root;
f8bde3d6
IB
65 extraConfig = [ chloe_dev.apache.vhostConf ];
66 };
3013caf1
IB
67 })
68 ];
69}