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

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

  config = lib.mkIf cfg.enable {
    secrets.keys = piedsjaloux.keys;
    services.myPhpfpm.preStart.piedsjaloux_dev = piedsjaloux.phpFpm.preStart;
    services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux.phpFpm.serviceDeps;
    services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux.phpFpm.pool;
    system.activationScripts.piedsjaloux_dev = piedsjaloux.activationScript;
    system.extraSystemBuilderCmds = ''
      mkdir -p $out/webapps
      ln -s ${piedsjaloux.app.webRoot} $out/webapps/${piedsjaloux.apache.webappName}
      '';
    services.websites.integration.modules = piedsjaloux.apache.modules;
    services.websites.integration.vhostConfs.piedsjaloux = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = [ "piedsjaloux.immae.eu" ];
      root        = piedsjaloux.apache.root;
      extraConfig = [ piedsjaloux.apache.vhostConf ];
    };
  };
}