aboutsummaryrefslogtreecommitdiff
path: root/virtual/modules/websites/chloe/default.nix
blob: 72a9b6fdb01667a395f30352096726e10b2e9240 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{ lib, pkgs, config, mylibs, ... }:
let
    chloe = pkgs.callPackage ./chloe.nix { inherit (mylibs) checkEnv fetchedGitPrivate; };
    chloe_dev = chloe { environment = "dev"; };
    chloe_prod = chloe { environment = "prod"; };

    cfg = config.services.myWebsites.Chloe;
in {
  options.services.myWebsites.Chloe = {
    production = {
      enable = lib.mkEnableOption "enable Chloe's website in production";
    };
    integration = {
      enable = lib.mkEnableOption "enable Chloe's website in integration";
    };
  };

  imports = [
    ../commons/stats.nix
  ];

  config = lib.mkMerge [
    (lib.mkIf cfg.production.enable {
      services.myWebsites.commons.stats.enable = true;
      services.myWebsites.commons.stats.sites = [
        {
          name = "osteopathe-cc.fr";
          conf = ./goaccess.conf;
        }
      ];

      security.acme.certs."chloe" = config.services.myCertificates.certConfig // {
        domain = "osteopathe-cc.fr";
        extraDomains = {
          "www.osteopathe-cc.fr" = null;
        };
      };

      services.phpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
      system.activationScripts.chloe_prod = chloe_prod.activationScript;
      services.myWebsites.production.modules = chloe_prod.apache.modules;
      services.myWebsites.production.vhostConfs.chloe = {
        certName    = "chloe";
        hosts       = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
        root        = chloe_prod.webRoot;
        extraConfig = [ chloe_prod.apache.vhostConf ];
      };
    })
    (lib.mkIf cfg.integration.enable {
      security.acme.certs."eldiron".extraDomains."chloe.immae.eu" = null;
      services.phpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
      system.activationScripts.chloe_dev = chloe_dev.activationScript;
      services.myWebsites.integration.modules = chloe_dev.apache.modules;
      services.myWebsites.integration.vhostConfs.chloe = {
        certName    = "eldiron";
        hosts       = ["chloe.immae.eu" ];
        root        = chloe_dev.webRoot;
        extraConfig = [ chloe_dev.apache.vhostConf ];
      };
    })
  ];
}