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

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

  config = lib.mkIf cfg.enable {
    services.phpApplication.aten_dev = let
      app = pkgs.webapps.aten.override { environment = "dev"; };
    in {
      websiteEnv = "integration";
      httpdUser = config.services.httpd.Inte.user;
      httpdGroup = config.services.httpd.Inte.group;
      inherit (app) webRoot varDir;
      inherit app;
      serviceDeps = [ "postgresql.service" ];
      preStartActions = [
        "APP_ENV=${app.environment} ./bin/console --env=${app.environment} cache:clear --no-warmup"
      ];
      watchFiles = [
        "${config.secrets.location}/webapps/${app.environment}-aten"
      ];
      webappName = "aten_dev";
    };

    secrets.keys = aten.keys;
    services.phpfpm.poolConfigs.aten_dev = aten.phpFpm.pool;
    services.websites.env.integration.vhostConfs.aten = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = [ "dev.aten.pro" ];
      root        = aten.apache.root;
      extraConfig = [ aten.apache.vhostConf ];
    };
  };
}