]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/chloe/default.nix
Move webstats outside of nixops
[perso/Immae/Config/Nix.git] / nixops / modules / websites / chloe / default.nix
CommitLineData
9d90e7e2 1{ lib, pkgs, config, myconfig, mylibs, ... }:
3013caf1 2let
9d90e7e2
IB
3 chloe = pkgs.callPackage ./chloe.nix { inherit (mylibs) fetchedGitPrivate; };
4 chloe_dev = chloe {
5 config = myconfig.env.websites.chloe.integration;
6 };
7 chloe_prod = chloe {
8 config = myconfig.env.websites.chloe.production;
9 };
86f6924f 10
3013caf1
IB
11 cfg = config.services.myWebsites.Chloe;
12in {
13 options.services.myWebsites.Chloe = {
14 production = {
15 enable = lib.mkEnableOption "enable Chloe's website in production";
16 };
17 integration = {
18 enable = lib.mkEnableOption "enable Chloe's website in integration";
19 };
20 };
21
22 config = lib.mkMerge [
23 (lib.mkIf cfg.production.enable {
1a718805 24 secrets.keys = chloe_prod.keys;
9eae2b47 25 services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ];
e4a945cd 26
3013caf1
IB
27 security.acme.certs."chloe" = config.services.myCertificates.certConfig // {
28 domain = "osteopathe-cc.fr";
29 extraDomains = {
30 "www.osteopathe-cc.fr" = null;
31 };
32 };
86f6924f 33
906065a0 34 services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps;
98584540 35 services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
912921a7
IB
36 services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
37 extension=${pkgs.php}/lib/php/extensions/mysqli.so
38 '';
86f6924f 39 system.activationScripts.chloe_prod = chloe_prod.activationScript;
e5073add
IB
40 system.extraSystemBuilderCmds = ''
41 mkdir -p $out/webapps
42 ln -s ${chloe_prod.webRoot} $out/webapps/${chloe_prod.apache.webappName}
43 '';
f8bde3d6
IB
44 services.myWebsites.production.modules = chloe_prod.apache.modules;
45 services.myWebsites.production.vhostConfs.chloe = {
46 certName = "chloe";
47 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
7da3ceec 48 root = chloe_prod.apache.root;
f8bde3d6
IB
49 extraConfig = [ chloe_prod.apache.vhostConf ];
50 };
3013caf1
IB
51 })
52 (lib.mkIf cfg.integration.enable {
1a718805 53 secrets.keys = chloe_dev.keys;
3013caf1 54 security.acme.certs."eldiron".extraDomains."chloe.immae.eu" = null;
906065a0 55 services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps;
98584540 56 services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
62a0946e 57 services.myPhpfpm.poolPhpConfigs.chloe_dev = ''
912921a7
IB
58 extension=${pkgs.php}/lib/php/extensions/mysqli.so
59 '';
86f6924f 60 system.activationScripts.chloe_dev = chloe_dev.activationScript;
e5073add
IB
61 system.extraSystemBuilderCmds = ''
62 mkdir -p $out/webapps
63 ln -s ${chloe_dev.webRoot} $out/webapps/${chloe_dev.apache.webappName}
64 '';
f8bde3d6
IB
65 services.myWebsites.integration.modules = chloe_dev.apache.modules;
66 services.myWebsites.integration.vhostConfs.chloe = {
67 certName = "eldiron";
68 hosts = ["chloe.immae.eu" ];
e5073add 69 root = chloe_dev.apache.root;
f8bde3d6
IB
70 extraConfig = [ chloe_dev.apache.vhostConf ];
71 };
3013caf1
IB
72 })
73 ];
74}