nixfiles/hosts/hetzner-vm/containers/storage/profiles/rclone-serve.nix

143 lines
4.1 KiB
Nix
Raw Normal View History

{config, ...}: let
2022-11-15 14:52:49 +00:00
secrets = config.services.secrets.secrets;
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"
"d /caches/backups_misskey_webdav_serve - storage storage"
2022-11-20 10:34:55 +00:00
];
2022-11-15 14:52:49 +00:00
services.rclone-serve = let
serviceConfig = {
after = ["auto-secrets.service"];
partOf = ["auto-secrets.service"];
2022-11-15 14:52:49 +00:00
};
in {
enable = true;
remotes = [
{
user = "storage";
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"
];
inherit serviceConfig;
}
{
user = "storage";
remote = "StorageBox:Backups/Misskey";
type = "webdav";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_webdav_misskey}"
"--htpasswd=${secrets.webdav_misskey_htpasswd.path}"
"--baseurl=/Misskey/"
"--cache-dir=/caches/backups_misskey_webdav_serve"
"--vfs-cache-max-age=30m"
"--vfs-cache-max-size=3g"
"--vfs-cache-mode=full"
];
inherit serviceConfig;
}
2022-11-20 10:34:55 +00:00
{
user = "storage";
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=30m"
"--vfs-cache-max-size=5g"
2022-11-20 10:34:55 +00:00
"--vfs-cache-mode=full"
];
inherit serviceConfig;
}
2022-11-15 14:52:49 +00:00
{
user = "storage";
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
];
inherit serviceConfig;
}
{
user = "storage";
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"
];
inherit serviceConfig;
}
{
user = "storage";
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"
];
inherit serviceConfig;
}
{
user = "storage";
remote = "StorageBox:Backups/Restic/HetznerVM";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_hvm}"
2022-11-15 14:52:49 +00:00
"--htpasswd=${secrets.restic_hetznervm_htpasswd.path}"
"--baseurl=/HetznerVM/"
];
inherit serviceConfig;
}
{
user = "storage";
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/"
];
inherit serviceConfig;
}
{
user = "storage";
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/"
];
inherit serviceConfig;
}
2022-12-20 15:28:31 +00:00
{
user = "storage";
remote = "StorageBox:Backups/Restic/Matrix";
type = "restic";
extraArgs = [
"--addr=0.0.0.0:${toString ports.rclone_serve_restic_matrix}"
"--htpasswd=${secrets.restic_matrix_htpasswd.path}"
"--baseurl=/Matrix/"
];
inherit serviceConfig;
}
2022-11-15 14:52:49 +00:00
];
};
}