]> git.immae.eu Git - perso/Immae/Config/Nix.git/blob - nixops/modules/websites/piedsjaloux/default.nix
Move integration websites to use stable web directory
[perso/Immae/Config/Nix.git] / nixops / modules / websites / piedsjaloux / default.nix
1 { lib, pkgs, config, myconfig, mylibs, ... }:
2 let
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 };
10
11 cfg = config.services.myWebsites.PiedsJaloux;
12 in {
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
22 imports = [
23 ../commons/stats.nix
24 ];
25
26 config = lib.mkMerge [
27 (lib.mkIf cfg.production.enable {
28 services.myWebsites.commons.stats.enable = true;
29 services.myWebsites.commons.stats.sites = [
30 {
31 name = "piedsjaloux.fr";
32 conf = ./goaccess.conf;
33 }
34 ];
35
36 security.acme.certs."piedsjaloux" = config.services.myCertificates.certConfig // {
37 domain = "piedsjaloux.fr";
38 extraDomains = {
39 "www.piedsjaloux.fr" = null;
40 };
41 };
42
43 services.myPhpfpm.poolConfigs.piedsjaloux_prod = piedsjaloux_prod.phpFpm.pool;
44 system.activationScripts.piedsjaloux_prod = piedsjaloux_prod.activationScript;
45 system.extraSystemBuilderCmds = ''
46 mkdir -p $out/webapps
47 ln -s ${piedsjaloux_prod.webRoot} $out/webapps/${piedsjaloux_prod.apache.webappName}
48 '';
49 services.myWebsites.production.modules = piedsjaloux_prod.apache.modules;
50 services.myWebsites.production.vhostConfs.piedsjaloux = {
51 certName = "piedsjaloux";
52 hosts = [ "piedsjaloux.fr" "www.piedsjaloux.fr" ];
53 root = piedsjaloux_prod.webRoot;
54 extraConfig = [ piedsjaloux_prod.apache.vhostConf ];
55 };
56 })
57 (lib.mkIf cfg.integration.enable {
58 security.acme.certs."eldiron".extraDomains."piedsjaloux.immae.eu" = null;
59 services.myPhpfpm.poolConfigs.piedsjaloux_dev = piedsjaloux_dev.phpFpm.pool;
60 system.activationScripts.piedsjaloux_dev = piedsjaloux_dev.activationScript;
61 system.extraSystemBuilderCmds = ''
62 mkdir -p $out/webapps
63 ln -s ${piedsjaloux_dev.webRoot} $out/webapps/${piedsjaloux_dev.apache.webappName}
64 '';
65 services.myWebsites.integration.modules = piedsjaloux_dev.apache.modules;
66 services.myWebsites.integration.vhostConfs.piedsjaloux = {
67 certName = "eldiron";
68 hosts = [ "piedsjaloux.immae.eu" ];
69 root = piedsjaloux_dev.apache.root;
70 extraConfig = [ piedsjaloux_dev.apache.vhostConf ];
71 };
72 })
73 ];
74 }
75