]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/connexionswing/default.nix
Remove mastodon build dependency on environment variables
[perso/Immae/Config/Nix.git] / nixops / modules / websites / connexionswing / default.nix
1 { lib, pkgs, config, mylibs, myconfig, ... }:
2 let
3 connexionswing = pkgs.callPackage ./connexionswing.nix { inherit (mylibs) fetchedGitPrivate; };
4 connexionswing_dev = connexionswing {
5 config = myconfig.env.websites.connexionswing.integration;
6 };
7 connexionswing_prod = connexionswing {
8 config = myconfig.env.websites.connexionswing.production;
9 };
10
11 cfg = config.services.myWebsites.Connexionswing;
12 in {
13 options.services.myWebsites.Connexionswing = {
14 production = {
15 enable = lib.mkEnableOption "enable Connexionswing's website in production";
16 };
17 integration = {
18 enable = lib.mkEnableOption "enable Connexionswing'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 mySecrets.keys = connexionswing_prod.keys;
29 services.myWebsites.commons.stats.enable = true;
30 services.myWebsites.commons.stats.sites = [
31 {
32 name = "connexionswing.com";
33 conf = ./goaccess.conf;
34 }
35 ];
36
37 security.acme.certs."connexionswing" = config.services.myCertificates.certConfig // {
38 domain = "connexionswing.com";
39 extraDomains = {
40 "www.connexionswing.com" = null;
41 "sandetludo.com" = null;
42 "www.sandetludo.com" = null;
43 };
44 };
45
46 services.myPhpfpm.preStart.connexionswing_prod = connexionswing_prod.phpFpm.preStart;
47 services.myPhpfpm.serviceDependencies.connexionswing_prod = connexionswing_prod.phpFpm.serviceDeps;
48 services.myPhpfpm.poolConfigs.connexionswing_prod = connexionswing_prod.phpFpm.pool;
49 services.myPhpfpm.poolPhpConfigs.connexionswing_prod = connexionswing_prod.phpFpm.phpConfig;
50 system.activationScripts.connexionswing_prod = connexionswing_prod.activationScript;
51 system.extraSystemBuilderCmds = ''
52 mkdir -p $out/webapps
53 ln -s ${connexionswing_prod.webRoot} $out/webapps/${connexionswing_prod.apache.webappName}
54 '';
55 services.myWebsites.production.modules = connexionswing_prod.apache.modules;
56 services.myWebsites.production.vhostConfs.connexionswing = {
57 certName = "connexionswing";
58 hosts = ["connexionswing.com" "sandetludo.com" "www.connexionswing.com" "www.sandetludo.com" ];
59 root = connexionswing_prod.apache.root;
60 extraConfig = [ connexionswing_prod.apache.vhostConf ];
61 };
62 })
63 (lib.mkIf cfg.integration.enable {
64 mySecrets.keys = connexionswing_dev.keys;
65 security.acme.certs."eldiron".extraDomains."sandetludo.immae.eu" = null;
66 security.acme.certs."eldiron".extraDomains."connexionswing.immae.eu" = null;
67 services.myPhpfpm.preStart.connexionswing_dev = connexionswing_dev.phpFpm.preStart;
68 services.myPhpfpm.serviceDependencies.connexionswing_dev = connexionswing_dev.phpFpm.serviceDeps;
69 services.myPhpfpm.poolConfigs.connexionswing_dev = connexionswing_dev.phpFpm.pool;
70 services.myPhpfpm.poolPhpConfigs.connexionswing_dev = connexionswing_dev.phpFpm.phpConfig;
71 system.activationScripts.connexionswing_dev = connexionswing_dev.activationScript;
72 system.extraSystemBuilderCmds = ''
73 mkdir -p $out/webapps
74 ln -s ${connexionswing_dev.webRoot} $out/webapps/${connexionswing_dev.apache.webappName}
75 '';
76 services.myWebsites.integration.modules = connexionswing_dev.apache.modules;
77 services.myWebsites.integration.vhostConfs.connexionswing = {
78 certName = "eldiron";
79 hosts = ["connexionswing.immae.eu" "sandetludo.immae.eu" ];
80 root = connexionswing_dev.apache.root;
81 extraConfig = [ connexionswing_dev.apache.vhostConf ];
82 };
83 })
84 ];
85 }
86