nixfiles/hosts/hetzner-arm/containers/storage/profiles/rcloneServe.nix

93 lines
2.3 KiB
Nix
Raw Normal View History

{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";
remote = "Storage:";
2022-11-15 14:52:49 +00:00
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.webdav_main}"
2022-11-15 14:52:49 +00:00
"--htpasswd=${secrets.webdav_main_htpasswd.path}"
"--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";
remote = "Storage:Music";
2022-11-15 14:52:49 +00:00
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.webdav_music_ro}"
2022-11-15 14:52:49 +00:00
"--read-only"
"--baseurl=/MusicRO/"
2022-11-15 14:52:49 +00:00
];
}
{
id = "uploads";
remote = "Storage:Uploads";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.webdav_uploads}"
"--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";
remote = "Storage:Music";
2022-11-15 14:52:49 +00:00
type = "http";
extraArgs = [
"--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";
remote = "Storage:Public";
2022-11-15 14:52:49 +00:00
type = "http";
extraArgs = [
"--addr=0.0.0.0:${toString ports.http_public}"
2022-11-15 14:52:49 +00:00
"--baseurl=/Public/"
"--read-only"
];
}
{
id = "uploads-public";
remote = "Storage:Uploads/Public";
type = "http";
extraArgs = [
"--addr=0.0.0.0:${toString ports.http_uploads_public}"
"--baseurl=/Uploads/"
"--read-only"
];
}
2022-11-15 14:52:49 +00:00
];
};
}