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

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

  config = lib.mkIf cfg.enable {
    secrets.keys = ludivinecassal.keys;

    systemd.services.phpfpm-ludivinecassal_dev.after = lib.mkAfter ludivinecassal.phpFpm.serviceDeps;
    systemd.services.phpfpm-ludivinecassal_dev.wants = ludivinecassal.phpFpm.serviceDeps;
    systemd.services.phpfpm-ludivinecassal_dev.preStart = lib.mkAfter ludivinecassal.phpFpm.preStart;
    services.phpfpm.poolConfigs.ludivinecassal_dev = ludivinecassal.phpFpm.pool;
    system.activationScripts.ludivinecassal_dev = ludivinecassal.activationScript;
    system.extraSystemBuilderCmds = ''
      mkdir -p $out/webapps
      ln -s ${ludivinecassal.app.webRoot} $out/webapps/${ludivinecassal.apache.webappName}
      '';
    services.websites.integration.modules = ludivinecassal.apache.modules;
    services.websites.integration.vhostConfs.ludivine = {
      certName    = "eldiron";
      addToCerts  = true;
      hosts       = [ "ludivine.immae.eu" ];
      root        = ludivinecassal.apache.root;
      extraConfig = [ ludivinecassal.apache.vhostConf ];
    };
  };
}