aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/florian/app.nix
blob: 08506e101a36ed05dd766f72e5b64acb09fec884 (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
{ lib, pkgs, config, myconfig,  ... }:
let
  adminer = pkgs.callPackage ../commons/adminer.nix {};

  tellesflorian  = pkgs.callPackage ./builder_app.nix {
    inherit (pkgs.webapps) tellesflorian;
    config = myconfig.env.websites.tellesflorian.integration;
    apacheUser = config.services.httpd.Inte.user;
    apacheGroup = config.services.httpd.Inte.group;
  };

  cfg = config.myServices.websites.florian.app;
in {
  options.myServices.websites.florian.app.enable = lib.mkEnableOption "enable Florian's app in integration";

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