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

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

  config = lib.mkIf cfg.enable {
    secrets.keys = connexionswing.keys;
    systemd.services.phpfpm-connexionswing_dev.after = lib.mkAfter connexionswing.phpFpm.serviceDeps;
    systemd.services.phpfpm-connexionswing_dev.wants = connexionswing.phpFpm.serviceDeps;
    systemd.services.phpfpm-connexionswing_dev.preStart = lib.mkAfter connexionswing.phpFpm.preStart;
    services.phpfpm.pools.connexionswing_dev = {
      listen = connexionswing.phpFpm.socket;
      extraConfig = connexionswing.phpFpm.pool;
      phpOptions = config.services.phpfpm.phpOptions + connexionswing.phpFpm.phpConfig;
    };
    system.activationScripts.connexionswing_dev = connexionswing.activationScript;
    myServices.websites.webappDirs."${connexionswing.apache.webappName}" = connexionswing.app.webRoot;
    services.websites.env.integration.modules = connexionswing.apache.modules;
    services.websites.env.integration.vhostConfs.connexionswing = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = ["connexionswing.immae.eu" "sandetludo.immae.eu" ];
      root        = connexionswing.apache.root;
      extraConfig = [ connexionswing.apache.vhostConf ];
    };
    services.filesWatcher.phpfpm-connexionswing_dev = {
      restart = true;
      paths = [ "/var/secrets/webapps/${connexionswing.app.environment}-connexionswing" ];
    };
  };
}