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

193 lines
5.6 KiB
Nix
Raw Normal View History

{config, ...}: let
2022-11-15 14:52:49 +00:00
secrets = 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
serviceConfig = {
after = ["auto-secrets.service"];
wants = ["auto-secrets.service"];
partOf = ["auto-secrets.service"];
};
}
// remote) [
{
id = "main";
2022-11-15 14:52:49 +00:00
remote = "StorageBox:";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_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"
];
}
2022-11-20 10:34:55 +00:00
{
2023-09-18 03:56:58 +01:00
id = "media-combine";
2022-11-20 10:34:55 +00:00
remote = "Media-Combine-Serve:";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_webdav_media}"
2022-11-20 10:34:55 +00:00
"--htpasswd=${secrets.webdav_media_htpasswd.path}"
"--baseurl=/Media/"
2022-11-20 10:34:55 +00:00
"--cache-dir=/caches/media_webdav_serve"
"--vfs-cache-max-age=120m"
"--vfs-cache-max-size=5g"
2022-11-20 10:34:55 +00:00
"--vfs-cache-mode=full"
];
}
2022-11-15 14:52:49 +00:00
{
2023-09-18 03:56:58 +01:00
id = "music-ro";
2022-11-15 14:52:49 +00:00
remote = "StorageBox:Music";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_webdav_music_ro}"
2022-11-15 14:52:49 +00:00
"--read-only"
"--baseurl=/MusicRO/"
2022-11-15 14:52:49 +00:00
];
}
{
id = "public";
remote = "StorageBox:Public";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_webdav_public}"
"--htpasswd=${secrets.webdav_media_htpasswd.path}"
"--baseurl=/Public/"
];
}
{
id = "uploads";
remote = "StorageBox:Uploads";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_webdav_uploads}"
"--htpasswd=${secrets.webdav_uploads_htpasswd.path}"
"--baseurl=/Uploads/"
];
}
2022-11-15 14:52:49 +00:00
{
2023-09-18 03:56:58 +01:00
id = "music-ro";
2022-11-15 14:52:49 +00:00
remote = "StorageBox:Music";
type = "http";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_http_music}"
2022-11-15 14:52:49 +00:00
"--baseurl=/Music/"
"--read-only"
];
}
{
2023-09-18 03:56:58 +01:00
id = "public";
2022-11-15 14:52:49 +00:00
remote = "StorageBox:Public";
type = "http";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_http_public}"
2022-11-15 14:52:49 +00:00
"--baseurl=/Public/"
"--read-only"
];
}
{
id = "uploads-public";
remote = "StorageBox:Uploads/Public";
type = "http";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_http_uploads_public}"
"--baseurl=/Uploads/"
"--read-only"
];
}
2022-11-15 14:52:49 +00:00
{
2023-09-18 03:56:58 +01:00
id = "restic-music";
2022-11-15 14:52:49 +00:00
remote = "StorageBox:Backups/Restic/Music";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_music}"
2022-11-15 14:52:49 +00:00
"--htpasswd=${secrets.restic_music_htpasswd.path}"
"--baseurl=/Music/"
];
}
{
2023-09-18 03:56:58 +01:00
id = "restic-vault";
2022-11-15 14:52:49 +00:00
remote = "StorageBox:Backups/Restic/Vault";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_vault}"
2022-11-15 14:52:49 +00:00
"--htpasswd=${secrets.restic_vault_htpasswd.path}"
"--baseurl=/Vault/"
];
}
2022-12-20 15:28:31 +00:00
{
2023-09-18 03:56:58 +01:00
id = "restic-social";
remote = "StorageBox:Backups/Restic/Social";
2022-12-20 15:28:31 +00:00
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_social}"
"--htpasswd=${secrets.restic_social_htpasswd.path}"
"--baseurl=/Social/"
2022-12-20 15:28:31 +00:00
];
}
2023-08-01 20:53:25 +01:00
{
2023-09-18 03:56:58 +01:00
id = "restic-quassel";
2023-08-01 20:53:25 +01:00
remote = "StorageBox:Backups/Restic/Quassel";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_quassel}"
"--htpasswd=${secrets.restic_quassel_htpasswd.path}"
"--baseurl=/Quassel/"
];
}
2023-08-01 22:06:30 +01:00
{
id = "restic-postgresql";
remote = "StorageBox:Backups/Restic/PostgreSQL";
2023-08-01 22:06:30 +01:00
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_postgresql}"
"--htpasswd=${secrets.restic_postgresql_htpasswd.path}"
"--baseurl=/PostgreSQL/"
];
}
{
id = "restic-caldav";
remote = "StorageBox:Backups/Restic/CalDAV";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_caldav}"
"--htpasswd=${secrets.restic_caldav_htpasswd.path}"
"--baseurl=/CalDAV/"
];
}
2023-08-09 15:11:04 +01:00
{
2023-09-18 03:56:58 +01:00
id = "restic-mail";
2023-08-09 15:11:04 +01:00
remote = "StorageBox:Backups/Restic/Mail";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_mail}"
"--htpasswd=${secrets.restic_mail_htpasswd.path}"
"--baseurl=/Mail/"
];
}
2023-09-30 16:49:52 +01:00
{
id = "restic-forgejo";
remote = "StorageBox:Backups/Restic/Forgejo";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_forgejo}"
"--htpasswd=${secrets.restic_forgejo_htpasswd.path}"
"--baseurl=/Forgejo/"
];
}
2022-11-15 14:52:49 +00:00
];
};
}