{ config, pkgs, lib, ... }: {
  users.users.webdav = {
    shell = pkgs.bashInteractive;
  };
  sops.secrets.webdav = {
    owner = config.services.webdav.user;
  };
  services.webdav = {
    enable = true;
    settings = {
      address = "0.0.0.0";
      port = 7350;
      scope = "/srv/webdav";
      modify = true;
      auth = true;
      users = [{
        username = "{env}ORG_MOBILE_USER";
        password = "{env}ORG_MOBILE_PASS";
      }];
    };
    environmentFile = config.sops.secrets.webdav.path;
  };

  services.caddy.virtualHosts = {
    "webdav.syzygial.cc" = {
      extraConfig = ''
        reverse_proxy 127.0.0.1:${toString config.services.webdav.settings.port}
      '';           
    };
  };
}
