From 9614b9ac6d6c6a3b00f414c0060cdf8e2ceb4246 Mon Sep 17 00:00:00 2001 From: cy Date: Sun, 5 Jan 2025 17:24:03 -0500 Subject: [PATCH] attic over rclone mount --- home/yt/chunk.nix | 3 +-- home/yt/common.nix | 3 +++ hosts/chunk/attic.nix | 14 +++++------- hosts/chunk/rclone.nix | 50 ++++++++++++++++-------------------------- 4 files changed, 29 insertions(+), 41 deletions(-) diff --git a/home/yt/chunk.nix b/home/yt/chunk.nix index ce0747c..3285421 100644 --- a/home/yt/chunk.nix +++ b/home/yt/chunk.nix @@ -16,8 +16,7 @@ systemd.user.startServices = "sd-switch"; home.packages = with pkgs; [ - bottom - btop foot.terminfo + attic-server ]; } diff --git a/home/yt/common.nix b/home/yt/common.nix index bd9995e..f14fc37 100644 --- a/home/yt/common.nix +++ b/home/yt/common.nix @@ -18,6 +18,9 @@ man-pages-posix man man-db + attic-client + bottom + btop ]; programs.zoxide.options = [ "--cmd cd" ]; diff --git a/hosts/chunk/attic.nix b/hosts/chunk/attic.nix index 14e1604..da509bd 100644 --- a/hosts/chunk/attic.nix +++ b/hosts/chunk/attic.nix @@ -14,17 +14,15 @@ database.url = "postgresql:///atticd?host=/run/postgresql"; storage = { - type = "s3"; - region = "auto"; - bucket = "cy7"; - endpoint = "https://e3e97aac307d106a7becea43cef8fcbd.r2.cloudflarestorage.com"; + type = "local"; + path = "/mnt/attic"; }; chunking = { - nar-size-threshold = 64 * 1024; # 64 KiB - min-size = 16 * 1024; # 16 KiB - avg-size = 64 * 1024; # 64 KiB - max-size = 256 * 1024; # 256 KiB + nar-size-threshold = 128 * 1024 * 1024; + min-size = 64 * 1024 * 1024; + avg-size = 128 * 1024 * 1024; + max-size = 256 * 1024 * 1024; }; }; }; diff --git a/hosts/chunk/rclone.nix b/hosts/chunk/rclone.nix index 60147a6..e283559 100644 --- a/hosts/chunk/rclone.nix +++ b/hosts/chunk/rclone.nix @@ -1,6 +1,7 @@ { pkgs, config, + lib, ... }: { @@ -14,41 +15,28 @@ serviceConfig = { Type = "notify"; ExecStartPre = "/usr/bin/env mkdir -p /mnt/photos"; - ExecStart = "${pkgs.rclone}/bin/rclone mount --config ${ + ExecStart = "${lib.getExe pkgs.rclone} mount --config ${ config.sops.secrets."rclone/config".path } --cache-dir /var/cache/rclone --transfers=32 --dir-cache-time 72h --vfs-cache-mode writes --vfs-cache-max-size 2G photos: /mnt/photos "; - ExecStop = "${pkgs.fuse}/bin/fusermount -u /mnt/photos"; + ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -u /mnt/photos"; }; }; - # systemd.services.nextcloud-mount = { - # enable = true; - # description = "Mount the nextcloud data remote"; - # after = ["network-online.target"]; - # requires = ["network-online.target"]; - # wantedBy = ["default.target"]; - # serviceConfig = { - # Type = "notify"; - # ExecStartPre = "/usr/bin/env mkdir -p /mnt/nextcloud"; - # ExecStart = "${pkgs.rclone}/bin/rclone mount --config /home/yt/.config/rclone/rclone.conf --uid 33 --gid 0 --allow-other --file-perms 0770 --dir-perms 0770 --transfers=32 rsyncnet:nextcloud /mnt/nextcloud"; - # ExecStop = "/bin/fusermount -u /mnt/nextcloud"; - # EnvironmentFile = config.sops.secrets."rclone/env".path; - # }; - # }; - - # systemd.services.jellyfin-mount = { - # enable = true; - # description = "Mount the jellyfin data remote"; - # after = ["network-online.target"]; - # requires = ["network-online.target"]; - # requiredBy = ["jellyfin.service"]; - # serviceConfig = { - # Type = "notify"; - # ExecStartPre = "/usr/bin/env mkdir -p /mnt/jellyfin"; - # ExecStart = "${pkgs.rclone}/bin/rclone mount --config /home/yt/.config/rclone/rclone.conf --allow-other --transfers=32 --dir-cache-time 72h --vfs-cache-mode writes --vfs-cache-max-size 2G jellyfin: /mnt/jellyfin"; - # ExecStop = "${pkgs.fuse}/bin/fusermount -u /mnt/jellyfin"; - # EnvironmentFile = config.sops.secrets."rclone/env".path; - # }; - # }; + systemd.services.attic-mount = { + enable = true; + description = "Mount the attic data remote"; + requires = [ "network-online.target" ]; + after = [ "network-online.target" ]; + requiredBy = [ "atticd.service" ]; + before = [ "atticd.service" ]; + serviceConfig = { + Type = "notify"; + ExecStartPre = "/usr/bin/env mkdir -p /mnt/attic"; + ExecStart = "${lib.getExe pkgs.rclone} mount --config ${ + config.sops.secrets."rclone/config".path + } --cache-dir /var/cache/rclone --transfers=32 --allow-other rsyncnet:attic /mnt/attic "; + ExecStop = "${lib.getExe' pkgs.fuse "fusermount"} -u /mnt/photos"; + }; + }; programs.fuse.userAllowOther = true; }