]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/piedsjaloux/default.nix
Remove direct dependency to myconfig in database modules
[perso/Immae/Config/Nix.git] / nixops / modules / websites / piedsjaloux / default.nix
CommitLineData
8a964143 1{ lib, pkgs, config, myconfig, ... }:
3013caf1 2let
313d19ce 3 piedsjaloux_dev = pkgs.callPackage ./piedsjaloux.nix {
8f904d0d 4 inherit (pkgs.webapps) piedsjaloux;
313d19ce
IB
5 config = myconfig.env.websites.piedsjaloux.integration;
6 };
7 piedsjaloux_prod = pkgs.callPackage ./piedsjaloux.nix {
8f904d0d 8 inherit (pkgs.webapps) piedsjaloux;
313d19ce
IB
9 config = myconfig.env.websites.piedsjaloux.production;
10 };
86f6924f 11
313d19ce 12 cfg = config.services.myWebsites.PiedsJaloux;
3013caf1
IB
13in {
14 options.services.myWebsites.PiedsJaloux = {
15 production = {
16 enable = lib.mkEnableOption "enable PiedsJaloux's website in production";
17 };
18 integration = {
19 enable = lib.mkEnableOption "enable PiedsJaloux's website in integration";
20 };
21 };
22
23 config = lib.mkMerge [
24 (lib.mkIf cfg.production.enable {
1a718805 25 secrets.keys = piedsjaloux_prod.keys;
9eae2b47 26 services.webstats.sites = [ { name = "piedsjaloux.fr"; } ];
e4a945cd 27
8eded9ec 28 services.myPhpfpm.preStart.piedsjaloux_prod = piedsjaloux_prod.phpFpm.preStart;
a0c845b4 29 services.myPhpfpm.serviceDependencies.piedsjaloux_prod = piedsjaloux_prod.phpFpm.serviceDeps;
98584540 30 services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool;
86f6924f 31 system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript;
e5073add
IB
32 system.extraSystemBuilderCmds = ''
33 mkdir -p $out/webapps
313d19ce 34 ln -s ${piedsjaloux_prod.app.webRoot} $out/webapps/${piedsjaloux_prod.apache.webappName}
e5073add 35 '';
daf64e3f
IB
36 services.websites.production.modules = piedsjaloux_prod.apache.modules;
37 services.websites.production.vhostConfs.piedsjaloux = {
7df420c2
IB
38 certName = "piedsjaloux";
39 certMainHost = "piedsjaloux.fr";
40 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
41 root = piedsjaloux_prod.apache.root;
42 extraConfig = [ piedsjaloux_prod.apache.vhostConf ];
f8bde3d6 43 };
3013caf1
IB
44 })
45 (lib.mkIf cfg.integration.enable {
1a718805 46 secrets.keys = piedsjaloux_dev.keys;
8eded9ec 47 services.myPhpfpm.preStart.piedsjaloux_dev = piedsjaloux_dev.phpFpm.preStart;
a0c845b4 48 services.myPhpfpm.serviceDependencies.piedsjaloux_dev = piedsjaloux_dev.phpFpm.serviceDeps;
98584540 49 services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool;
86f6924f 50 system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript;
e5073add
IB
51 system.extraSystemBuilderCmds = ''
52 mkdir -p $out/webapps
313d19ce 53 ln -s ${piedsjaloux_dev.app.webRoot} $out/webapps/${piedsjaloux_dev.apache.webappName}
e5073add 54 '';
daf64e3f
IB
55 services.websites.integration.modules = piedsjaloux_dev.apache.modules;
56 services.websites.integration.vhostConfs.piedsjaloux = {
f8bde3d6 57 certName = "eldiron";
7df420c2 58 addToCerts = true;
f8bde3d6 59 hosts = [ "piedsjaloux.immae.eu" ];
e5073add 60 root = piedsjaloux_dev.apache.root;
f8bde3d6
IB
61 extraConfig = [ piedsjaloux_dev.apache.vhostConf ];
62 };
3013caf1
IB
63 })
64 ];
65}
66