about summary refs log tree commit diff
path: root/machines/srv3/services/webdav/default.nix
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2024-10-30 20:16:45 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2024-10-30 20:16:45 +0100
commit009a43799c28eca77752de4268c0e74700d13527 (patch)
tree5eb771177ef9ccde32ecdaa11149549b5e9ea19e /machines/srv3/services/webdav/default.nix
parent9c14b06fc484e4be8852c4f379cb1671ed367d6a (diff)
downloaddots-009a43799c28eca77752de4268c0e74700d13527.tar.gz
dots-009a43799c28eca77752de4268c0e74700d13527.zip
srv3: move services to folder HEAD master
Diffstat (limited to 'machines/srv3/services/webdav/default.nix')
-rw-r--r--machines/srv3/services/webdav/default.nix47
1 files changed, 47 insertions, 0 deletions
diff --git a/machines/srv3/services/webdav/default.nix b/machines/srv3/services/webdav/default.nix
new file mode 100644
index 0000000..e184490
--- /dev/null
+++ b/machines/srv3/services/webdav/default.nix
@@ -0,0 +1,47 @@
+{ config, lib, ... }:
+let
+cfg = config.services.srv3-webdav;
+in
+{
+
+	options = {
+		services.srv3-webdav = {
+			enable = lib.mkEnableOption "WebDav server";
+
+			domain = lib.mkOption {
+				type = lib.types.str;
+				description = "Where webdav server should live";
+			};
+
+			port = lib.mkOption {
+				type = lib.types.number;
+				default = 6060;
+# FIX: Hardening reverse proxy
+				description = "Internal port on which webdav server will run";
+			};
+			
+			configFile = lib.mkOption {
+				type = lib.types.path;
+				default = "/etc/webdav.yaml";
+				description = "WebDav server config file";
+			};
+		};
+
+	};
+	config = lib.mkIf cfg.enable {
+		services.nginx.virtualHosts.${cfg.domain} = {
+			forceSSL = true;
+			enableACME = true;
+
+			locations."/" = {
+				proxyPass = "http://localhost:${toString cfg.port}";
+			};
+		};
+
+		services.webdav = {
+			enable = true;
+			configFile = cfg.configFile;
+		};
+	};
+
+}