]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/connexionswing/default.nix
Patch bundix to avoid raises at runtime
[perso/Immae/Config/Nix.git] / nixops / modules / websites / connexionswing / default.nix
CommitLineData
8a964143 1{ lib, pkgs, config, myconfig, ... }:
3013caf1 2let
52e8779d 3 connexionswing_dev = pkgs.callPackage ./connexionswing.nix {
8f904d0d 4 inherit (pkgs.webapps) connexionswing;
52e8779d
IB
5 config = myconfig.env.websites.connexionswing.integration;
6 };
7 connexionswing_prod = pkgs.callPackage ./connexionswing.nix {
8f904d0d 8 inherit (pkgs.webapps) connexionswing;
52e8779d
IB
9 config = myconfig.env.websites.connexionswing.production;
10 };
86f6924f 11
52e8779d 12 cfg = config.services.myWebsites.Connexionswing;
3013caf1
IB
13in {
14 options.services.myWebsites.Connexionswing = {
15 production = {
16 enable = lib.mkEnableOption "enable Connexionswing's website in production";
17 };
18 integration = {
19 enable = lib.mkEnableOption "enable Connexionswing's website in integration";
20 };
21 };
22
23 config = lib.mkMerge [
24 (lib.mkIf cfg.production.enable {
1a718805 25 secrets.keys = connexionswing_prod.keys;
9eae2b47 26 services.webstats.sites = [ { name = "connexionswing.com"; } ];
e4a945cd 27
3013caf1
IB
28 security.acme.certs."connexionswing" = config.services.myCertificates.certConfig // {
29 domain = "connexionswing.com";
30 extraDomains = {
31 "www.connexionswing.com" = null;
32 "sandetludo.com" = null;
33 "www.sandetludo.com" = null;
34 };
35 };
86f6924f 36
8eded9ec 37 services.myPhpfpm.preStart.connexionswing_prod = connexionswing_prod.phpFpm.preStart;
a0c845b4 38 services.myPhpfpm.serviceDependencies.connexionswing_prod = connexionswing_prod.phpFpm.serviceDeps;
98584540 39 services.myPhpfpm.poolConfigs.connexionswing_prod = connexionswing_prod.phpFpm.pool;
2abb172b 40 services.myPhpfpm.poolPhpConfigs.connexionswing_prod = connexionswing_prod.phpFpm.phpConfig;
86f6924f 41 system.activationScripts.connexionswing_prod = connexionswing_prod.activationScript;
e5073add
IB
42 system.extraSystemBuilderCmds = ''
43 mkdir -p $out/webapps
52e8779d 44 ln -s ${connexionswing_prod.app.webRoot} $out/webapps/${connexionswing_prod.apache.webappName}
e5073add 45 '';
daf64e3f
IB
46 services.websites.production.modules = connexionswing_prod.apache.modules;
47 services.websites.production.vhostConfs.connexionswing = {
f8bde3d6
IB
48 certName = "connexionswing";
49 hosts = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ];
7da3ceec 50 root = connexionswing_prod.apache.root;
f8bde3d6
IB
51 extraConfig = [ connexionswing_prod.apache.vhostConf ];
52 };
3013caf1
IB
53 })
54 (lib.mkIf cfg.integration.enable {
1a718805 55 secrets.keys = connexionswing_dev.keys;
3013caf1
IB
56 security.acme.certs."eldiron".extraDomains."sandetludo.immae.eu" = null;
57 security.acme.certs."eldiron".extraDomains."connexionswing.immae.eu" = null;
8eded9ec 58 services.myPhpfpm.preStart.connexionswing_dev = connexionswing_dev.phpFpm.preStart;
a0c845b4 59 services.myPhpfpm.serviceDependencies.connexionswing_dev = connexionswing_dev.phpFpm.serviceDeps;
98584540 60 services.myPhpfpm.poolConfigs.connexionswing_dev = connexionswing_dev.phpFpm.pool;
2abb172b 61 services.myPhpfpm.poolPhpConfigs.connexionswing_dev = connexionswing_dev.phpFpm.phpConfig;
86f6924f 62 system.activationScripts.connexionswing_dev = connexionswing_dev.activationScript;
e5073add
IB
63 system.extraSystemBuilderCmds = ''
64 mkdir -p $out/webapps
52e8779d 65 ln -s ${connexionswing_dev.app.webRoot} $out/webapps/${connexionswing_dev.apache.webappName}
e5073add 66 '';
daf64e3f
IB
67 services.websites.integration.modules = connexionswing_dev.apache.modules;
68 services.websites.integration.vhostConfs.connexionswing = {
f8bde3d6
IB
69 certName = "eldiron";
70 hosts = ["connexionswing.immae.eu" "sandetludo.immae.eu" ];
e5073add 71 root = connexionswing_dev.apache.root;
f8bde3d6
IB
72 extraConfig = [ connexionswing_dev.apache.vhostConf ];
73 };
3013caf1
IB
74 })
75 ];
76}
77