]> git.immae.eu Git - perso/Immae/Config/Nix.git/blame - nixops/modules/websites/aten/default.nix
Move Aten and Connexionswing secrets to secure location
[perso/Immae/Config/Nix.git] / nixops / modules / websites / aten / default.nix
CommitLineData
9d90e7e2 1{ lib, pkgs, config, myconfig, mylibs, ... }:
3013caf1 2let
33aa7e5c 3 aten = pkgs.callPackage ./aten.nix { inherit (mylibs) fetchedGitPrivate yarn2nixPackage; };
9d90e7e2
IB
4 aten_dev = aten {
5 config = myconfig.env.websites.aten.integration;
6 };
7 aten_prod = aten {
8 config = myconfig.env.websites.aten.production;
9 };
86f6924f 10
3013caf1
IB
11 cfg = config.services.myWebsites.Aten;
12in {
13 options.services.myWebsites.Aten = {
14 production = {
15 enable = lib.mkEnableOption "enable Aten's website in production";
16 };
17 integration = {
18 enable = lib.mkEnableOption "enable Aten's website in integration";
19 };
20 };
21
091ae734
IB
22 imports = [
23 ../commons/stats.nix
24 ];
25
3013caf1
IB
26 config = lib.mkMerge [
27 (lib.mkIf cfg.production.enable {
a754e9db 28 deployment.keys = aten_prod.keys;
e4a945cd
IB
29 services.myWebsites.commons.stats.enable = true;
30 services.myWebsites.commons.stats.sites = [
31 {
32 name = "aten.pro";
091ae734 33 conf = ./goaccess.conf;
e4a945cd
IB
34 }
35 ];
36
3013caf1
IB
37 security.acme.certs."aten" = config.services.myCertificates.certConfig // {
38 domain = "aten.pro";
39 extraDomains = {
40 "www.aten.pro" = null;
41 };
42 };
86f6924f 43
98584540 44 services.myPhpfpm.poolConfigs.aten_prod = aten_prod.phpFpm.pool;
86f6924f 45 system.activationScripts.aten_prod = aten_prod.activationScript;
e5073add
IB
46 system.extraSystemBuilderCmds = ''
47 mkdir -p $out/webapps
48 ln -s ${aten_prod.webRoot} $out/webapps/${aten_prod.apache.webappName}
49 '';
42429ef0 50 services.myWebsites.apacheConfig.aten_prod.modules = aten_prod.apache.modules;
f8bde3d6
IB
51 services.myWebsites.production.modules = aten_prod.apache.modules;
52 services.myWebsites.production.vhostConfs.aten = {
53 certName = "aten";
54 hosts = [ "aten.pro" "www.aten.pro" ];
7da3ceec 55 root = aten_prod.apache.root;
f8bde3d6
IB
56 extraConfig = [ aten_prod.apache.vhostConf ];
57 };
3013caf1
IB
58 })
59 (lib.mkIf cfg.integration.enable {
a754e9db 60 deployment.keys = aten_dev.keys;
3013caf1 61 security.acme.certs."eldiron".extraDomains."dev.aten.pro" = null;
98584540 62 services.myPhpfpm.poolConfigs.aten_dev = aten_dev.phpFpm.pool;
86f6924f 63 system.activationScripts.aten_dev = aten_dev.activationScript;
e5073add
IB
64 system.extraSystemBuilderCmds = ''
65 mkdir -p $out/webapps
66 ln -s ${aten_dev.webRoot} $out/webapps/${aten_dev.apache.webappName}
67 '';
f8bde3d6
IB
68 services.myWebsites.integration.modules = aten_dev.apache.modules;
69 services.myWebsites.integration.vhostConfs.aten = {
70 certName = "eldiron";
71 hosts = [ "dev.aten.pro" ];
e5073add 72 root = aten_dev.apache.root;
f8bde3d6
IB
73 extraConfig = [ aten_dev.apache.vhostConf ];
74 };
3013caf1
IB
75 })
76 ];
77}
78