]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/piedsjaloux/default.nix
Add missing service dependencies
[perso/Immae/Config/Nix.git] / nixops / modules / websites / piedsjaloux / default.nix
CommitLineData
9d90e7e2 1{ lib, pkgs, config, myconfig, mylibs, ... }:
3013caf1 2let
9d90e7e2
IB
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 };
86f6924f 10
3013caf1
IB
11 cfg = config.services.myWebsites.PiedsJaloux;
12in {
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
e4a945cd 22 imports = [
091ae734 23 ../commons/stats.nix
e4a945cd
IB
24 ];
25
3013caf1
IB
26 config = lib.mkMerge [
27 (lib.mkIf cfg.production.enable {
6e23a06b 28 deployment.keys = piedsjaloux_prod.keys;
e4a945cd
IB
29 services.myWebsites.commons.stats.enable = true;
30 services.myWebsites.commons.stats.sites = [
31 {
32 name = "piedsjaloux.fr";
091ae734 33 conf = ./goaccess.conf;
e4a945cd
IB
34 }
35 ];
36
3013caf1
IB
37 security.acme.certs."piedsjaloux" = config.services.myCertificates.certConfig // {
38 domain = "piedsjaloux.fr";
39 extraDomains = {
40 "www.piedsjaloux.fr" = null;
41 };
42 };
86f6924f 43
a0c845b4 44 services.myPhpfpm.serviceDependencies.piedsjaloux_prod = piedsjaloux_prod.phpFpm.serviceDeps;
98584540 45 services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool;
86f6924f 46 system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript;
e5073add
IB
47 system.extraSystemBuilderCmds = ''
48 mkdir -p $out/webapps
49 ln -s ${piedsjaloux_prod.webRoot} $out/webapps/${piedsjaloux_prod.apache.webappName}
50 '';
f8bde3d6
IB
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" ];
7da3ceec 55 root = piedsjaloux_prod.apache.root;
f8bde3d6
IB
56 extraConfig = [ piedsjaloux_prod.apache.vhostConf ];
57 };
3013caf1
IB
58 })
59 (lib.mkIf cfg.integration.enable {
6e23a06b 60 deployment.keys = piedsjaloux_dev.keys;
3013caf1 61 security.acme.certs."eldiron".extraDomains."piedsjaloux.immae.eu" = null;
a0c845b4 62 services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux_dev.phpFpm.serviceDeps;
98584540 63 services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool;
86f6924f 64 system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript;
e5073add
IB
65 system.extraSystemBuilderCmds = ''
66 mkdir -p $out/webapps
67 ln -s ${piedsjaloux_dev.webRoot} $out/webapps/${piedsjaloux_dev.apache.webappName}
68 '';
f8bde3d6
IB
69 services.myWebsites.integration.modules = piedsjaloux_dev.apache.modules;
70 services.myWebsites.integration.vhostConfs.piedsjaloux = {
71 certName = "eldiron";
72 hosts = [ "piedsjaloux.immae.eu" ];
e5073add 73 root = piedsjaloux_dev.apache.root;
f8bde3d6
IB
74 extraConfig = [ piedsjaloux_dev.apache.vhostConf ];
75 };
3013caf1
IB
76 })
77 ];
78}
79