aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/connexionswing/integration.nix
blob: 6570977f6e3d5c891f4cfbacdfcb9365eb5f743a (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
{ 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;
    system.extraSystemBuilderCmds = ''
      mkdir -p $out/webapps
      ln -s ${connexionswing.app.webRoot} $out/webapps/${connexionswing.apache.webappName}
      '';
    services.websites.integration.modules = connexionswing.apache.modules;
    services.websites.integration.vhostConfs.connexionswing = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = ["connexionswing.immae.eu" "sandetludo.immae.eu" ];
      root        = connexionswing.apache.root;
      extraConfig = [ connexionswing.apache.vhostConf ];
    };
  };
}