Something went wrong. Try again.
Flake for my desktop, laptop, and my homelab.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138{ flake.aspects.rclone.homeManager = { # keep-sorted start config, lib, pkgs, vars, # keep-sorted end ... }: let inherit (lib) # keep-sorted start getExe mapAttrs' nameValuePair # keep-sorted end ;
inherit (vars) # keep-sorted start groundDomain username # keep-sorted end ;
syncs = { # keep-sorted start block=yes newline_separated=yes screenshots = { localPath = "${config.home.homeDirectory}/Pictures/screenshots"; remotePath = "copyparty:/u/${username}/Pictures/screenshots"; };
wallpapers = { localPath = "${config.home.homeDirectory}/Pictures/wallpapers"; remotePath = "copyparty:/u/${username}/Pictures/wallpapers"; }; # keep-sorted end };
mkBisyncService = name: sync: { Unit = { After = ["rclone-config.service"]; Description = "Bidirectional sync for copyparty ${name}"; Requires = ["rclone-config.service"]; };
Service = { Environment = [ "LOCAL_PATH=${sync.localPath}" "REMOTE_PATH=${sync.remotePath}" "WORK_DIR=${config.xdg.stateHome}/rclone/bisync/copyparty-${name}" ]; ExecStart = getExe pkgs.rclone-bisync-runner; Type = "oneshot"; }; };
mkBisyncTimer = name: _: { Unit.Description = "Bidirectional sync for copyparty ${name}";
Timer = { OnBootSec = "5m"; OnUnitActiveSec = "15m"; Persistent = true; };
Install.WantedBy = ["timers.target"]; }; in { sops.secrets = { # keep-sorted start "rclone/copyparty_basic_auth_header" = {}; "rclone/google_token" = {}; # keep-sorted end };
programs.rclone = { enable = true;
remotes = { copyparty = { config = { type = "webdav"; url = "https://copyparty.${groundDomain}"; vendor = "other"; };
mounts."/u/${username}" = { enable = true; mountPoint = "${config.home.homeDirectory}/Remote/copyparty"; options.vfs-cache-mode = "writes"; };
secrets.headers = config.sops.secrets."rclone/copyparty_basic_auth_header".path; };
google = { config = { scope = "drive"; type = "drive"; };
mounts."" = { enable = true; mountPoint = "${config.home.homeDirectory}/Remote/google"; options.vfs-cache-mode = "writes"; };
secrets.token = config.sops.secrets."rclone/google_token".path; }; }; };
systemd.user = { tmpfiles.rules = [ # keep-sorted start "d ${config.home.homeDirectory}/Remote/copyparty 0755 - - -" "d ${config.home.homeDirectory}/Remote/google 0755 - - -" # keep-sorted end ];
services = mapAttrs' ( name: sync: nameValuePair "copyparty-${name}-bisync" (mkBisyncService name sync) ) syncs;
timers = mapAttrs' ( name: sync: nameValuePair "copyparty-${name}-bisync" (mkBisyncTimer name sync) ) syncs; }; };}