2023-11-15 21:37:20 +08:00
|
|
|
inputs:
|
|
|
|
{
|
|
|
|
options.nixos.services.nginx.applications.webdav = let inherit (inputs.lib) mkOption types; in
|
|
|
|
{
|
|
|
|
enable = mkOption { type = types.bool; default = false; };
|
|
|
|
};
|
|
|
|
config =
|
|
|
|
let
|
|
|
|
inherit (inputs.config.nixos.services.nginx.applications) webdav;
|
|
|
|
inherit (inputs.lib) mkIf;
|
|
|
|
in mkIf webdav.enable
|
|
|
|
{
|
|
|
|
nixos.services.nginx.https."webdav.chn.moe".location."/".static =
|
|
|
|
{
|
|
|
|
root = "/srv/webdav";
|
|
|
|
index = "auto";
|
|
|
|
charset = "utf-8";
|
|
|
|
webdav = true;
|
|
|
|
detectAuth.users = [ "chn" ];
|
|
|
|
};
|
2023-11-16 11:57:02 +08:00
|
|
|
systemd =
|
|
|
|
{
|
|
|
|
tmpfiles.rules = [ "d /srv/webdav 0700 nginx nginx" ];
|
|
|
|
services.nginx.serviceConfig.ReadWritePaths = [ "/srv/webdav" ];
|
|
|
|
};
|
2023-11-15 21:37:20 +08:00
|
|
|
};
|
|
|
|
}
|