2022-12-04 13:45:43 +00:00
|
|
|
{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 = [
|
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"
|
|
|
|
];
|
|
|
|
}
|
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 = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.webdav_media}"
|
2022-11-20 10:34:55 +00:00
|
|
|
"--htpasswd=${secrets.webdav_media_htpasswd.path}"
|
2023-01-07 11:59:13 +00:00
|
|
|
"--baseurl=/Media/"
|
2022-11-20 10:34:55 +00:00
|
|
|
"--cache-dir=/caches/media_webdav_serve"
|
2023-08-01 19:14:19 +01:00
|
|
|
"--vfs-cache-max-age=120m"
|
2022-11-20 12:24:57 +00:00
|
|
|
"--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 = [
|
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 = "public";
|
|
|
|
remote = "StorageBox:Public";
|
|
|
|
type = "webdav";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.webdav_public}"
|
2023-10-10 22:22:54 +01:00
|
|
|
"--htpasswd=${secrets.webdav_media_htpasswd.path}"
|
|
|
|
"--baseurl=/Public/"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
{
|
|
|
|
id = "uploads";
|
|
|
|
remote = "StorageBox:Uploads";
|
|
|
|
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/"
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
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 = [
|
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";
|
2022-11-15 14:52:49 +00:00
|
|
|
remote = "StorageBox:Public";
|
|
|
|
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";
|
|
|
|
remote = "StorageBox:Uploads/Public";
|
|
|
|
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
|
|
|
{
|
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 = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.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 = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.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";
|
2023-07-29 16:41:20 +01:00
|
|
|
remote = "StorageBox:Backups/Restic/Social";
|
2022-12-20 15:28:31 +00:00
|
|
|
type = "restic";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.restic_social}"
|
2023-07-29 16:41:20 +01:00
|
|
|
"--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 = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.restic_quassel}"
|
2023-08-01 20:53:25 +01:00
|
|
|
"--htpasswd=${secrets.restic_quassel_htpasswd.path}"
|
|
|
|
"--baseurl=/Quassel/"
|
|
|
|
];
|
|
|
|
}
|
2023-08-01 22:06:30 +01:00
|
|
|
{
|
2023-10-02 03:08:24 +01:00
|
|
|
id = "restic-postgresql";
|
|
|
|
remote = "StorageBox:Backups/Restic/PostgreSQL";
|
2023-08-01 22:06:30 +01:00
|
|
|
type = "restic";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.restic_postgresql}"
|
2023-10-02 03:08:24 +01:00
|
|
|
"--htpasswd=${secrets.restic_postgresql_htpasswd.path}"
|
|
|
|
"--baseurl=/PostgreSQL/"
|
2023-09-21 05:06:27 +01:00
|
|
|
];
|
|
|
|
}
|
2023-10-10 22:22:54 +01:00
|
|
|
{
|
|
|
|
id = "restic-caldav";
|
|
|
|
remote = "StorageBox:Backups/Restic/CalDAV";
|
|
|
|
type = "restic";
|
|
|
|
extraArgs = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.restic_caldav}"
|
2023-10-10 22:22:54 +01:00
|
|
|
"--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 = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.restic_mail}"
|
2023-08-09 15:11:04 +01:00
|
|
|
"--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 = [
|
2023-10-16 20:02:47 +01:00
|
|
|
"--addr=0.0.0.0:${toString ports.restic_forgejo}"
|
2023-09-30 16:49:52 +01:00
|
|
|
"--htpasswd=${secrets.restic_forgejo_htpasswd.path}"
|
|
|
|
"--baseurl=/Forgejo/"
|
|
|
|
];
|
|
|
|
}
|
2023-10-27 17:44:32 +01:00
|
|
|
{
|
|
|
|
id = "restic-owncast";
|
|
|
|
remote = "StorageBox:Backups/Restic/Owncast";
|
|
|
|
type = "restic";
|
|
|
|
extraArgs = [
|
|
|
|
"--addr=0.0.0.0:${toString ports.restic_owncast}"
|
|
|
|
"--htpasswd=${secrets.restic_owncast_htpasswd.path}"
|
|
|
|
"--baseurl=/Owncast/"
|
|
|
|
];
|
|
|
|
}
|
2022-11-15 14:52:49 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|