]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - nixops/modules/websites/chloe/default.nix
Start moving websites configuration to modules
[perso/Immae/Config/Nix.git] / nixops / modules / websites / chloe / default.nix
index f561834e3fb102b3fc96816a7631c8e1b4ac5d65..ba72d92d799b4ed0b5deb17e9c66263ebc7c410e 100644 (file)
@@ -1,14 +1,15 @@
-{ lib, pkgs, config, myconfig, mylibs, ... }:
+{ lib, pkgs, config, myconfig,  ... }:
 let
-    chloe = pkgs.callPackage ./chloe.nix { inherit (mylibs) fetchedGitPrivate; };
-    chloe_dev  = chloe {
-      config = myconfig.env.websites.chloe.integration;
-    };
-    chloe_prod = chloe {
-      config = myconfig.env.websites.chloe.production;
-    };
+  chloe_dev  = pkgs.callPackage ./chloe.nix {
+    inherit (pkgs.webapps) chloe;
+    config = myconfig.env.websites.chloe.integration;
+  };
+  chloe_prod = pkgs.callPackage ./chloe.nix {
+    inherit (pkgs.webapps) chloe;
+    config = myconfig.env.websites.chloe.production;
+  };
 
-    cfg = config.services.myWebsites.Chloe;
+  cfg = config.services.myWebsites.Chloe;
 in {
   options.services.myWebsites.Chloe = {
     production = {
@@ -19,19 +20,10 @@ in {
     };
   };
 
-  imports = [
-    ../commons/stats.nix
-  ];
-
   config = lib.mkMerge [
     (lib.mkIf cfg.production.enable {
-      services.myWebsites.commons.stats.enable = true;
-      services.myWebsites.commons.stats.sites = [
-        {
-          name = "osteopathe-cc.fr";
-          conf = ./goaccess.conf;
-        }
-      ];
+      secrets.keys = chloe_prod.keys;
+      services.webstats.sites = [ { name = "osteopathe-cc.fr"; } ];
 
       security.acme.certs."chloe" = config.services.myCertificates.certConfig // {
         domain = "osteopathe-cc.fr";
@@ -40,6 +32,7 @@ in {
         };
       };
 
+      services.myPhpfpm.serviceDependencies.chloe_prod = chloe_prod.phpFpm.serviceDeps;
       services.myPhpfpm.poolConfigs.chloe_prod = chloe_prod.phpFpm.pool;
       services.myPhpfpm.poolPhpConfigs.chloe_prod = ''
         extension=${pkgs.php}/lib/php/extensions/mysqli.so
@@ -47,10 +40,10 @@ in {
       system.activationScripts.chloe_prod = chloe_prod.activationScript;
       system.extraSystemBuilderCmds = ''
         mkdir -p $out/webapps
-        ln -s ${chloe_prod.webRoot} $out/webapps/${chloe_prod.apache.webappName}
+        ln -s ${chloe_prod.app.webRoot} $out/webapps/${chloe_prod.apache.webappName}
         '';
-      services.myWebsites.production.modules = chloe_prod.apache.modules;
-      services.myWebsites.production.vhostConfs.chloe = {
+      services.websites.production.modules = chloe_prod.apache.modules;
+      services.websites.production.vhostConfs.chloe = {
         certName    = "chloe";
         hosts       = ["osteopathe-cc.fr" "www.osteopathe-cc.fr" ];
         root        = chloe_prod.apache.root;
@@ -58,7 +51,9 @@ in {
       };
     })
     (lib.mkIf cfg.integration.enable {
+      secrets.keys = chloe_dev.keys;
       security.acme.certs."eldiron".extraDomains."chloe.immae.eu" = null;
+      services.myPhpfpm.serviceDependencies.chloe_dev = chloe_dev.phpFpm.serviceDeps;
       services.myPhpfpm.poolConfigs.chloe_dev = chloe_dev.phpFpm.pool;
       services.myPhpfpm.poolPhpConfigs.chloe_dev = ''
         extension=${pkgs.php}/lib/php/extensions/mysqli.so
@@ -66,10 +61,10 @@ in {
       system.activationScripts.chloe_dev = chloe_dev.activationScript;
       system.extraSystemBuilderCmds = ''
         mkdir -p $out/webapps
-        ln -s ${chloe_dev.webRoot} $out/webapps/${chloe_dev.apache.webappName}
+        ln -s ${chloe_dev.app.webRoot} $out/webapps/${chloe_dev.apache.webappName}
         '';
-      services.myWebsites.integration.modules = chloe_dev.apache.modules;
-      services.myWebsites.integration.vhostConfs.chloe = {
+      services.websites.integration.modules = chloe_dev.apache.modules;
+      services.websites.integration.vhostConfs.chloe = {
         certName    = "eldiron";
         hosts       = ["chloe.immae.eu" ];
         root        = chloe_dev.apache.root;