]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/chloe/production.nix
Move personal websites to modules
[perso/Immae/Config/Nix.git] / modules / private / websites / chloe / production.nix
diff --git a/modules/private/websites/chloe/production.nix b/modules/private/websites/chloe/production.nix
new file mode 100644 (file)
index 0000000..0eafebd
--- /dev/null
@@ -0,0 +1,37 @@
+{ lib, pkgs, config, myconfig,  ... }:
+let
+  chloe = pkgs.callPackage ./builder.nix {
+    inherit (pkgs.webapps) chloe;
+    config = myconfig.env.websites.chloe.production;
+    apacheUser = config.services.httpd.Prod.user;
+    apacheGroup = config.services.httpd.Prod.group;
+  };
+
+  cfg = config.myServices.websites.chloe.production;
+in {
+  options.myServices.websites.chloe.production.enable = lib.mkEnableOption "enable Chloe's website in production";
+
+  config = lib.mkIf cfg.enable {
+    secrets.keys = chloe.keys;
+    services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ];
+
+    services.myPhpfpm.serviceDependencies.chloe_prod = chloe.phpFpm.serviceDeps;
+    services.myPhpfpm.poolConfigs.chloe_prod = chloe.phpFpm.pool;
+    services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
+      extension=${pkgs.php}/lib/php/extensions/mysqli.so
+      '';
+    system.activationScripts.chloe_prod = chloe.activationScript;
+    system.extraSystemBuilderCmds = ''
+      mkdir -p $out/webapps
+      ln -s ${chloe.app.webRoot} $out/webapps/${chloe.apache.webappName}
+      '';
+    services.websites.production.modules = chloe.apache.modules;
+    services.websites.production.vhostConfs.chloe = {
+      certName     = "chloe";
+      certMainHost = "osteopathe-cc.fr";
+      hosts        = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
+      root         = chloe.apache.root;
+      extraConfig  = [ chloe.apache.vhostConf ];
+    };
+  };
+}