]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/chloe/default.nix
Start moving websites configuration to 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
3013caf1
IB
28 security.acme.certs."chloe" = config.services.myCertificates.certConfig // {
29 domain = "osteopathe-cc.fr";
30 extraDomains = {
31 "www.osteopathe-cc.fr" = null;
32 };
33 };
86f6924f 34
906065a0 35 services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps;
98584540 36 services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
912921a7
IB
37 services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
38 extension=${pkgs.php}/lib/php/extensions/mysqli.so
39 '';
86f6924f 40 system.activationScripts.chloe_prod = chloe_prod.activationScript;
e5073add
IB
41 system.extraSystemBuilderCmds = ''
42 mkdir -p $out/webapps
7667c367 43 ln -s ${chloe_prod.app.webRoot} $out/webapps/${chloe_prod.apache.webappName}
e5073add 44 '';
daf64e3f
IB
45 services.websites.production.modules = chloe_prod.apache.modules;
46 services.websites.production.vhostConfs.chloe = {
f8bde3d6
IB
47 certName = "chloe";
48 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
7da3ceec 49 root = chloe_prod.apache.root;
f8bde3d6
IB
50 extraConfig = [ chloe_prod.apache.vhostConf ];
51 };
3013caf1
IB
52 })
53 (lib.mkIf cfg.integration.enable {
1a718805 54 secrets.keys = chloe_dev.keys;
3013caf1 55 security.acme.certs."eldiron".extraDomains."chloe.immae.eu" = null;
906065a0 56 services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps;
98584540 57 services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
62a0946e 58 services.myPhpfpm.poolPhpConfigs.chloe_dev = ''
912921a7
IB
59 extension=${pkgs.php}/lib/php/extensions/mysqli.so
60 '';
86f6924f 61 system.activationScripts.chloe_dev = chloe_dev.activationScript;
e5073add
IB
62 system.extraSystemBuilderCmds = ''
63 mkdir -p $out/webapps
7667c367 64 ln -s ${chloe_dev.app.webRoot} $out/webapps/${chloe_dev.apache.webappName}
e5073add 65 '';
daf64e3f
IB
66 services.websites.integration.modules = chloe_dev.apache.modules;
67 services.websites.integration.vhostConfs.chloe = {
f8bde3d6
IB
68 certName = "eldiron";
69 hosts = ["chloe.immae.eu" ];
e5073add 70 root = chloe_dev.apache.root;
f8bde3d6
IB
71 extraConfig = [ chloe_dev.apache.vhostConf ];
72 };
3013caf1
IB
73 })
74 ];
75}