aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/aten/integration.nix
blob: 384b32454e191d01eda6706d493cb54ae37759b9 (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
{ 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 {
    secrets.keys = aten.keys;
    systemd.services.phpfpm-aten_dev.preStart = lib.mkAfter aten.phpFpm.preStart;
    systemd.services.phpfpm-aten_dev.after = lib.mkAfter aten.phpFpm.serviceDeps;
    systemd.services.phpfpm-aten_dev.wants = aten.phpFpm.serviceDeps;
    services.phpfpm.poolConfigs.aten_dev = aten.phpFpm.pool;
    system.activationScripts.aten_dev = aten.activationScript;
    myServices.websites.webappDirs."${aten.apache.webappName}" = aten.app.webRoot;
    services.websites.integration.modules = aten.apache.modules;
    services.websites.integration.vhostConfs.aten = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = [ "dev.aten.pro" ];
      root        = aten.apache.root;
      extraConfig = [ aten.apache.vhostConf ];
    };
    services.websites.integration.watchPaths = [
      "/var/secrets/webapps/${aten.app.environment}-aten"
    ];
  };
}