]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/piedsjaloux/default.nix
Add missing service dependencies
[perso/Immae/Config/Nix.git] / nixops / modules / websites / piedsjaloux / default.nix
1 { lib, pkgs, config, myconfig, mylibs, ... }:
2 let
3 piedsjaloux = pkgs.callPackage ./piedsjaloux.nix { inherit (mylibs) fetchedGitPrivate; };
4 piedsjaloux_dev = piedsjaloux {
5 config = myconfig.env.websites.piedsjaloux.integration;
6 };
7 piedsjaloux_prod = piedsjaloux {
8 config = myconfig.env.websites.piedsjaloux.production;
9 };
10
11 cfg = config.services.myWebsites.PiedsJaloux;
12 in {
13 options.services.myWebsites.PiedsJaloux = {
14 production = {
15 enable = lib.mkEnableOption "enable PiedsJaloux's website in production";
16 };
17 integration = {
18 enable = lib.mkEnableOption "enable PiedsJaloux's website in integration";
19 };
20 };
21
22 imports = [
23 ../commons/stats.nix
24 ];
25
26 config = lib.mkMerge [
27 (lib.mkIf cfg.production.enable {
28 deployment.keys = piedsjaloux_prod.keys;
29 services.myWebsites.commons.stats.enable = true;
30 services.myWebsites.commons.stats.sites = [
31 {
32 name = "piedsjaloux.fr";
33 conf = ./goaccess.conf;
34 }
35 ];
36
37 security.acme.certs."piedsjaloux" = config.services.myCertificates.certConfig // {
38 domain = "piedsjaloux.fr";
39 extraDomains = {
40 "www.piedsjaloux.fr" = null;
41 };
42 };
43
44 services.myPhpfpm.serviceDependencies.piedsjaloux_prod = piedsjaloux_prod.phpFpm.serviceDeps;
45 services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool;
46 system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript;
47 system.extraSystemBuilderCmds = ''
48 mkdir -p $out/webapps
49 ln -s ${piedsjaloux_prod.webRoot} $out/webapps/${piedsjaloux_prod.apache.webappName}
50 '';
51 services.myWebsites.production.modules = piedsjaloux_prod.apache.modules;
52 services.myWebsites.production.vhostConfs.piedsjaloux = {
53 certName = "piedsjaloux";
54 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
55 root = piedsjaloux_prod.apache.root;
56 extraConfig = [ piedsjaloux_prod.apache.vhostConf ];
57 };
58 })
59 (lib.mkIf cfg.integration.enable {
60 deployment.keys = piedsjaloux_dev.keys;
61 security.acme.certs."eldiron".extraDomains."piedsjaloux.immae.eu" = null;
62 services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux_dev.phpFpm.serviceDeps;
63 services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool;
64 system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript;
65 system.extraSystemBuilderCmds = ''
66 mkdir -p $out/webapps
67 ln -s ${piedsjaloux_dev.webRoot} $out/webapps/${piedsjaloux_dev.apache.webappName}
68 '';
69 services.myWebsites.integration.modules = piedsjaloux_dev.apache.modules;
70 services.myWebsites.integration.vhostConfs.piedsjaloux = {
71 certName = "eldiron";
72 hosts = [ "piedsjaloux.immae.eu" ];
73 root = piedsjaloux_dev.apache.root;
74 extraConfig = [ piedsjaloux_dev.apache.vhostConf ];
75 };
76 })
77 ];
78 }
79