aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/connexionswing/production.nix
blob: b51c549fdbd1abe6342f0e0ba924565b39586ff3 (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
{ lib, pkgs, config,  myconfig, ... }:
let
  connexionswing = pkgs.callPackage ./builder.nix {
    inherit (pkgs.webapps) connexionswing;
    config = myconfig.env.websites.connexionswing.production;
    apacheUser = config.services.httpd.Prod.user;
    apacheGroup = config.services.httpd.Prod.group;
  };

  cfg = config.myServices.websites.connexionswing.production;
in {
  options.myServices.websites.connexionswing.production.enable = lib.mkEnableOption "enable Connexionswing's website in production";

  config = lib.mkIf cfg.enable {
    secrets.keys = connexionswing.keys;
    services.webstats.sites = [ { name = "connexionswing.com"; } ];

    systemd.services.phpfpm-connexionswing_prod.after = lib.mkAfter connexionswing.phpFpm.serviceDeps;
    systemd.services.phpfpm-connexionswing_prod.wants = connexionswing.phpFpm.serviceDeps;
    systemd.services.phpfpm-connexionswing_prod.preStart = lib.mkAfter connexionswing.phpFpm.preStart;
    services.phpfpm.pools.connexionswing_prod = {
      listen = connexionswing.phpFpm.socket;
      extraConfig = connexionswing.phpFpm.pool;
      phpOptions = config.services.phpfpm.phpOptions + connexionswing.phpFpm.phpConfig;
    };
    system.activationScripts.connexionswing_prod = connexionswing.activationScript;
    system.extraSystemBuilderCmds = ''
      mkdir -p $out/webapps
      ln -s ${connexionswing.app.webRoot} $out/webapps/${connexionswing.apache.webappName}
      '';
    services.websites.production.modules = connexionswing.apache.modules;
    services.websites.production.vhostConfs.connexionswing = {
      certName     = "connexionswing";
      certMainHost = "connexionswing.com";
      hosts        = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ];
      root         = connexionswing.apache.root;
      extraConfig  = [ connexionswing.apache.vhostConf ];
    };
  };
}