]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/chloe/default.nix
Move secrets module outside of nixops
[perso/Immae/Config/Nix.git] / nixops / modules / websites / chloe / default.nix
1 { lib, pkgs, config, myconfig, mylibs, ... }:
2 let
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 };
10
11 cfg = config.services.myWebsites.Chloe;
12 in {
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 imports = [
23 ../commons/stats.nix
24 ];
25
26 config = lib.mkMerge [
27 (lib.mkIf cfg.production.enable {
28 secrets.keys = chloe_prod.keys;
29 services.myWebsites.commons.stats.enable = true;
30 services.myWebsites.commons.stats.sites = [
31 {
32 name = "osteopathe-cc.fr";
33 conf = ./goaccess.conf;
34 }
35 ];
36
37 security.acme.certs."chloe" = config.services.myCertificates.certConfig // {
38 domain = "osteopathe-cc.fr";
39 extraDomains = {
40 "www.osteopathe-cc.fr" = null;
41 };
42 };
43
44 services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps;
45 services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
46 services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
47 extension=${pkgs.php}/lib/php/extensions/mysqli.so
48 '';
49 system.activationScripts.chloe_prod = chloe_prod.activationScript;
50 system.extraSystemBuilderCmds = ''
51 mkdir -p $out/webapps
52 ln -s ${chloe_prod.webRoot} $out/webapps/${chloe_prod.apache.webappName}
53 '';
54 services.myWebsites.production.modules = chloe_prod.apache.modules;
55 services.myWebsites.production.vhostConfs.chloe = {
56 certName = "chloe";
57 hosts = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
58 root = chloe_prod.apache.root;
59 extraConfig = [ chloe_prod.apache.vhostConf ];
60 };
61 })
62 (lib.mkIf cfg.integration.enable {
63 secrets.keys = chloe_dev.keys;
64 security.acme.certs."eldiron".extraDomains."chloe.immae.eu" = null;
65 services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps;
66 services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
67 services.myPhpfpm.poolPhpConfigs.chloe_dev = ''
68 extension=${pkgs.php}/lib/php/extensions/mysqli.so
69 '';
70 system.activationScripts.chloe_dev = chloe_dev.activationScript;
71 system.extraSystemBuilderCmds = ''
72 mkdir -p $out/webapps
73 ln -s ${chloe_dev.webRoot} $out/webapps/${chloe_dev.apache.webappName}
74 '';
75 services.myWebsites.integration.modules = chloe_dev.apache.modules;
76 services.myWebsites.integration.vhostConfs.chloe = {
77 certName = "eldiron";
78 hosts = ["chloe.immae.eu" ];
79 root = chloe_dev.apache.root;
80 extraConfig = [ chloe_dev.apache.vhostConf ];
81 };
82 })
83 ];
84 }