]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - virtual/modules/websites/tools/tools/default.nix
Refactor websites.
[perso/Immae/Config/Nix.git] / virtual / modules / websites / tools / tools / default.nix
diff --git a/virtual/modules/websites/tools/tools/default.nix b/virtual/modules/websites/tools/tools/default.nix
new file mode 100644 (file)
index 0000000..f29ac11
--- /dev/null
@@ -0,0 +1,65 @@
+{ lib, pkgs, config, mylibs, ... }:
+let
+    adminer = pkgs.callPackage ../../commons/adminer.nix {};
+    ympd = pkgs.callPackage ./ympd.nix {};
+    ttrss = pkgs.callPackage ./ttrss.nix { inherit (mylibs) checkEnv fetchedGithub fetchedGit; };
+    roundcubemail = pkgs.callPackage ./roundcubemail.nix { inherit (mylibs) checkEnv; };
+
+    cfg = config.services.myWebsites.tools.tools;
+in {
+  options.services.myWebsites.tools.tools = {
+    enable = lib.mkEnableOption "enable tools website";
+  };
+
+  config = lib.mkIf cfg.enable {
+    security.acme.certs."eldiron".extraDomains."tools.immae.eu" = null;
+
+    services.myWebsites.tools.modules =
+      adminer.apache.modules
+      ++ ympd.apache.modules
+      ++ ttrss.apache.modules
+      ++ roundcubemail.apache.modules;
+
+    services.ympd = ympd.config // { enable = false; };
+
+    services.myWebsites.tools.vhostConfs.tools = {
+      certName    = "eldiron";
+      hosts       = ["tools.immae.eu" ];
+      root        = null;
+      extraConfig = [
+        adminer.apache.vhostConf
+        ympd.apache.vhostConf
+        ttrss.apache.vhostConf
+        roundcubemail.apache.vhostConf
+      ];
+    };
+
+    services.myPhpfpm.poolConfigs = {
+      adminer = adminer.phpFpm.pool;
+      ttrss = ttrss.phpFpm.pool;
+      roundcubemail = roundcubemail.phpFpm.pool;
+    };
+
+    system.activationScripts = {
+      ttrss = ttrss.activationScript;
+      roundcubemail = roundcubemail.activationScript;
+    };
+
+    systemd.services.tt-rss = {
+      description = "Tiny Tiny RSS feeds update daemon";
+      serviceConfig = {
+        User = "wwwrun";
+        ExecStart = "${pkgs.php}/bin/php ${ttrss.webRoot}/update.php --daemon";
+        StandardOutput = "syslog";
+        StandardError = "syslog";
+        PermissionsStartOnly = true;
+      };
+
+      wantedBy = [ "multi-user.target" ];
+      requires = ["postgresql.service"];
+      after = ["network.target" "postgresql.service"];
+    };
+
+  };
+}
+