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