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

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

  config = lib.mkIf cfg.enable {
    services.duplyBackup.profiles.chloe_dev.rootDir = chloe.app.varDir;
    secrets.keys = chloe.keys;
    systemd.services.phpfpm-chloe_dev.after = lib.mkAfter chloe.phpFpm.serviceDeps;
    systemd.services.phpfpm-chloe_dev.wants = chloe.phpFpm.serviceDeps;
    services.phpfpm.pools.chloe_dev = {
      listen = chloe.phpFpm.socket;
      extraConfig = chloe.phpFpm.pool;
      phpOptions = config.services.phpfpm.phpOptions + ''
        extension=${pkgs.php}/lib/php/extensions/mysqli.so
      '';
    };
    system.activationScripts.chloe_dev = chloe.activationScript;
    myServices.websites.webappDirs."${chloe.apache.webappName}" = chloe.app.webRoot;
    services.websites.env.integration.modules = chloe.apache.modules;
    services.websites.env.integration.vhostConfs.chloe = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = ["chloe.immae.eu" ];
      root        = chloe.apache.root;
      extraConfig = [ chloe.apache.vhostConf ];
    };
    services.websites.env.integration.watchPaths = [
      "/var/secrets/webapps/${chloe.app.environment}-chloe"
    ];
  };
}