]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/private/websites/florian/production.nix
Move personal websites to modules
[perso/Immae/Config/Nix.git] / modules / private / websites / florian / production.nix
diff --git a/modules/private/websites/florian/production.nix b/modules/private/websites/florian/production.nix
new file mode 100644 (file)
index 0000000..9b310b8
--- /dev/null
@@ -0,0 +1,34 @@
+{ lib, pkgs, config, myconfig,  ... }:
+let
+    adminer = pkgs.callPackage ../commons/adminer.nix {};
+    cfg = config.myServices.websites.florian.production;
+    varDir = "/var/lib/ftp/florian";
+    env = myconfig.env.websites.florian;
+in {
+  options.myServices.websites.florian.production.enable = lib.mkEnableOption "enable Florian's website production";
+
+  config = lib.mkIf cfg.enable {
+    security.acme.certs."ftp".extraDomains."tellesflorian.com" = null;
+
+    services.websites.production.modules = adminer.apache.modules;
+    services.websites.production.vhostConfs.florian = {
+      certName     = "florian";
+      certMainHost = "tellesflorian.com";
+      hosts        = [ "tellesflorian.com" "www.tellesflorian.com" ];
+      root         = "${varDir}/tellesflorian.com";
+      extraConfig  = [
+        adminer.apache.vhostConf
+        ''
+        ServerAdmin ${env.server_admin}
+
+        <Directory ${varDir}/tellesflorian.com>
+          DirectoryIndex index.php index.htm index.html
+          Options Indexes FollowSymLinks MultiViews Includes
+          AllowOverride None
+          Require all granted
+        </Directory>
+          ''
+      ];
+    };
+  };
+}