aboutsummaryrefslogtreecommitdiff
path: root/modules/private/websites/piedsjaloux/production.nix
blob: e3bd2ddcc37742de8b5094b6e47cd848902d9bb7 (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.production;
    apacheUser = config.services.httpd.Prod.user;
    apacheGroup = config.services.httpd.Prod.group;
  };

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

  config = lib.mkIf cfg.enable {
    secrets.keys = piedsjaloux.keys;
    services.webstats.sites = [ { name = "piedsjaloux.fr"; } ];

    systemd.services.phpfpm-piedsjaloux_prod.after = lib.mkAfter piedsjaloux.phpFpm.serviceDeps;
    systemd.services.phpfpm-piedsjaloux_prod.wants = piedsjaloux.phpFpm.serviceDeps;
    systemd.services.phpfpm-piedsjaloux_prod.preStart = lib.mkAfter piedsjaloux.phpFpm.preStart;
    services.phpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux.phpFpm.pool;
    system.activationScripts.piedsjaloux_prod = piedsjaloux.activationScript;
    myServices.websites.webappDirs."${piedsjaloux.apache.webappName}" = piedsjaloux.app.webRoot;
    services.websites.production.modules = piedsjaloux.apache.modules;
    services.websites.production.vhostConfs.piedsjaloux = {
      certName     = "piedsjaloux";
      certMainHost = "piedsjaloux.fr";
      hosts        = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
      root         = piedsjaloux.apache.root;
      extraConfig  = [ piedsjaloux.apache.vhostConf ];
    };
  };
}