aboutsummaryrefslogtreecommitdiff
path: root/nixops/modules/websites/connexionswing/default.nix
blob: 5ce3525f2e53eff22fca6acb580e3b115d33971b (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
63
64
65
66
67
68
69
70
71
72
{ lib, pkgs, config, mylibs, myconfig, ... }:
let
    connexionswing = pkgs.callPackage ./connexionswing.nix { inherit (mylibs) fetchedGitPrivate; };
    connexionswing_dev  = connexionswing {
      config = myconfig.env.websites.connexionswing.integration;
    };
    connexionswing_prod = connexionswing {
      config = myconfig.env.websites.connexionswing.production;
    };

    cfg = config.services.myWebsites.Connexionswing;
in {
  options.services.myWebsites.Connexionswing = {
    production = {
      enable = lib.mkEnableOption "enable Connexionswing's website in production";
    };
    integration = {
      enable = lib.mkEnableOption "enable Connexionswing'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 = "connexionswing.com";
          conf = ./goaccess.conf;
        }
      ];

      security.acme.certs."connexionswing" = config.services.myCertificates.certConfig // {
        domain = "connexionswing.com";
        extraDomains = {
          "www.connexionswing.com" = null;
          "sandetludo.com" = null;
          "www.sandetludo.com" = null;
        };
      };

      services.myPhpfpm.poolConfigs.connexionswing_prod = connexionswing_prod.phpFpm.pool;
      services.myPhpfpm.poolPhpConfigs.connexionswing_prod = connexionswing_prod.phpFpm.phpConfig;
      system.activationScripts.connexionswing_prod = connexionswing_prod.activationScript;
      services.myWebsites.production.modules = connexionswing_prod.apache.modules;
      services.myWebsites.production.vhostConfs.connexionswing = {
        certName    = "connexionswing";
        hosts       = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ];
        root        = connexionswing_prod.webRoot;
        extraConfig = [ connexionswing_prod.apache.vhostConf ];
      };
    })
    (lib.mkIf cfg.integration.enable {
      security.acme.certs."eldiron".extraDomains."sandetludo.immae.eu" = null;
      security.acme.certs."eldiron".extraDomains."connexionswing.immae.eu" = null;
      services.myPhpfpm.poolConfigs.connexionswing_dev = connexionswing_dev.phpFpm.pool;
      services.myPhpfpm.poolPhpConfigs.connexionswing_dev = connexionswing_dev.phpFpm.phpConfig;
      system.activationScripts.connexionswing_dev = connexionswing_dev.activationScript;
      services.myWebsites.integration.modules = connexionswing_dev.apache.modules;
      services.myWebsites.integration.vhostConfs.connexionswing = {
        certName    = "eldiron";
        hosts       = ["connexionswing.immae.eu" "sandetludo.immae.eu" ];
        root        = connexionswing_dev.webRoot;
        extraConfig = [ connexionswing_dev.apache.vhostConf ];
      };
    })
  ];
}