2022-12-04 13:45:43 +00:00
|
|
|
{config, ...}: let
|
2024-03-10 17:26:18 +00:00
|
|
|
inherit (config.services.secrets) secrets;
|
2023-09-18 03:56:58 +01:00
|
|
|
ports = import ../data/ports.nix;
|
2022-11-15 14:52:49 +00:00
|
|
|
in {
|
2022-11-20 10:34:55 +00:00
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"d /caches - storage storage"
|
|
|
|
"d /caches/main_webdav_serve - storage storage"
|
|
|
|
"d /caches/media_webdav_serve - storage storage"
|
|
|
|
];
|
|
|
|
|
2023-09-18 03:56:58 +01:00
|
|
|
services.rclone-serve = {
|
2022-11-15 14:52:49 +00:00
|
|
|
enable = true;
|
2023-09-18 03:56:58 +01:00
|
|
|
remotes = map (remote:
|
2022-11-15 14:52:49 +00:00
|
|
|
{
|
|
|
|
user = "storage";
|
2023-09-18 03:56:58 +01:00
|
|
|
}
|
|
|
|
// remote) [
|
|
|
|
{
|
|
|
|
id = "main";
|
2024-07-06 17:20:28 +01:00
|
|
|
remote = "Storage:";
|
2022-11-15 14:52:49 +00:00
|
|
|
type = "webdav";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.webdav_main}"
|
2022-11-15 14:52:49 +00:00
|
|
|
"--htpasswd=${secrets.webdav_main_htpasswd.path}"
|
2023-01-07 11:59:13 +00:00
|
|
|
"--baseurl=/Main/"
|
2022-11-15 14:52:49 +00:00
|
|
|
"--cache-dir=/caches/main_webdav_serve"
|
|
|
|
"--vfs-cache-mode=full"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
2023-09-18 03:56:58 +01:00
|
|
|
id = "music-ro";
|
2024-07-06 17:20:28 +01:00
|
|
|
remote = "Storage:Music";
|
2022-11-15 14:52:49 +00:00
|
|
|
type = "webdav";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.webdav_music_ro}"
|
2022-11-15 14:52:49 +00:00
|
|
|
"--read-only"
|
2023-01-07 11:59:13 +00:00
|
|
|
"--baseurl=/MusicRO/"
|
2022-11-15 14:52:49 +00:00
|
|
|
];
|
|
|
|
}
|
2023-10-10 22:22:54 +01:00
|
|
|
{
|
|
|
|
id = "uploads";
|
2024-07-06 17:20:28 +01:00
|
|
|
remote = "Storage:Uploads";
|
2023-10-10 22:22:54 +01:00
|
|
|
type = "webdav";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.webdav_uploads}"
|
2023-10-10 22:22:54 +01:00
|
|
|
"--htpasswd=${secrets.webdav_uploads_htpasswd.path}"
|
|
|
|
"--baseurl=/Uploads/"
|
|
|
|
];
|
|
|
|
}
|
2024-04-26 19:57:02 +01:00
|
|
|
{
|
|
|
|
id = "notes";
|
|
|
|
remote = "Notes:";
|
|
|
|
type = "webdav";
|
|
|
|
extraArgs = [
|
|
|
|
"--addr=0.0.0.0:${toString ports.webdav_notes}"
|
|
|
|
"--htpasswd=${secrets.webdav_notes_htpasswd.path}"
|
|
|
|
"--baseurl=/Notes/"
|
2023-11-17 13:10:54 +00:00
|
|
|
];
|
|
|
|
}
|
2022-11-15 14:52:49 +00:00
|
|
|
{
|
2023-09-18 03:56:58 +01:00
|
|
|
id = "music-ro";
|
2024-07-06 17:20:28 +01:00
|
|
|
remote = "Storage:Music";
|
2022-11-15 14:52:49 +00:00
|
|
|
type = "http";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.http_music}"
|
2022-11-15 14:52:49 +00:00
|
|
|
"--baseurl=/Music/"
|
|
|
|
"--read-only"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
2023-09-18 03:56:58 +01:00
|
|
|
id = "public";
|
2024-07-06 17:20:28 +01:00
|
|
|
remote = "Storage:Public";
|
2022-11-15 14:52:49 +00:00
|
|
|
type = "http";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.http_public}"
|
2022-11-15 14:52:49 +00:00
|
|
|
"--baseurl=/Public/"
|
|
|
|
"--read-only"
|
|
|
|
];
|
|
|
|
}
|
2023-10-10 22:22:54 +01:00
|
|
|
{
|
|
|
|
id = "uploads-public";
|
2024-07-06 17:20:28 +01:00
|
|
|
remote = "Storage:Uploads/Public";
|
2023-10-10 22:22:54 +01:00
|
|
|
type = "http";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.http_uploads_public}"
|
2023-10-10 22:22:54 +01:00
|
|
|
"--baseurl=/Uploads/"
|
|
|
|
"--read-only"
|
|
|
|
];
|
|
|
|
}
|
2022-11-15 14:52:49 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|