commit fe5b06ad9a4d57840a1aa8448a01698c781d684e
parent 55794c7e6f1113f0fcfc2d66dce7bb605bea7325
Author: breadcat <breadcat@users.noreply.github.com>
Date: Wed, 6 Aug 2025 11:32:26 +0100
Define rclone config
Diffstat:
6 files changed, 47 insertions(+), 8 deletions(-)
diff --git a/common/tank-log.nix b/common/tank-log.nix
@@ -25,9 +25,9 @@ let
rm "$file_git_log"
fi
printf "Creating log...\n"
- rclone ls "$log_remote" | sort -k2 >"$file_git_log"
+ ${pkgs.rclone}/bin/rclone ls "$log_remote" | sort -k2 >"$file_git_log"
printf "Appending size information...\n"
- rclone size "$log_remote" >>"$file_git_log"
+ ${pkgs.rclone}/bin/rclone size "$log_remote" >>"$file_git_log"
printf "Commiting log file to repository...\n"
$git_logger add "$file_git_log"
$git_logger commit -m "Update: $(date +%F)"
diff --git a/common/tank-sort.nix b/common/tank-sort.nix
@@ -4,14 +4,13 @@ let
tank-sort = pkgs.writeShellScriptBin "tank-sort" ''
# variables
temp_mount="$(mktemp -d)"
- rclone_config="$HOME/vault/src/dockerfiles/rclone.conf"
rclone_remote="seedbox:"
destination_tvshows="/mnt/media/videos/television"
template_tvshows="{{ .Name }}/{{ .Name }} S{{ printf \"%02d\" .Season }}E{{ printf \"%02d\" .Episode }}{{ if ne .ExtraEpisode -1 }}-{{ printf \"%02d\" .ExtraEpisode }}{{end}}.{{ .Ext }}"
destination_movies="/mnt/media/videos/movies"
template_movies="{{ .Name }} ({{ .Year }})/{{ .Name }}.{{ .Ext }}"
# mount remote
- ${pkgs.rclone}/bin/rclone --config="$rclone_config" mount "$rclone_remote" "$temp_mount" --daemon
+ ${pkgs.rclone}/bin/rclone mount "$rclone_remote" "$temp_mount" --daemon
# sorting process
media-sort --action copy --concurrency 1 --accuracy-threshold 90 --tv-dir "$destination_tvshows" --movie-dir "$destination_movies" --tv-template "$template_tvshows" --movie-template "$template_movies" --recursive --overwrite-if-larger --extensions "mp4,m4v,mkv" "$temp_mount"
# unmount remote and remove
diff --git a/home/rclone.nix b/home/rclone.nix
@@ -0,0 +1,40 @@
+{ username, domain, sshport, privatekey, ... }:
+
+{
+ programs.rclone = {
+ enable = true;
+ remotes = {
+ artemis.config = {
+ type = "sftp";
+ host = "${domain}";
+ port = sshport;
+ user = "${username}";
+ key_file = "${privatekey}";
+ shell_type = "cmd";
+ };
+ seedbox.config = {
+ type = "alias";
+ remote = "artemis:/tank/complete";
+ };
+ incomplete.config = {
+ type = "alias";
+ remote = "artemis:/tank/incomplete";
+ };
+ phone.config = {
+ type = "sftp";
+ host = "phone";
+ port = "1234";
+ user = "ftp";
+ key_file = "${privatekey}";
+ };
+ nas.config = {
+ type = "alias";
+ remote = "/mnt/media";
+ };
+ myrient.config = {
+ type = "http";
+ url = "https://myrient.erista.me/files/";
+ };
+ };
+ };
+}
diff --git a/machines/artemis.nix b/machines/artemis.nix
@@ -49,6 +49,7 @@ in {
../home/htop.nix
../home/neovim.nix
(import ../home/rbw.nix {inherit pkgs domain email;})
+ (import ../home/rclone.nix {inherit domain username sshport privatekey;})
(import ../home/ssh.nix {inherit domain username sshport privatekey;})
];
home.stateVersion = "25.05";
diff --git a/machines/ilias.nix b/machines/ilias.nix
@@ -27,7 +27,6 @@ in {
(import ../common/magnets.nix {inherit pkgs username;})
../common/packages.nix
(import ../common/restic.nix {inherit pkgs username;})
- (import ../common/ssh-tunnel.nix {inherit config pkgs username domain sshport;})
(import ../common/ssh-tunnel.nix {inherit config pkgs username domain sshport privatekey;})
(import ../common/ssh.nix {inherit username sshkey sshport;})
(import ../common/syncthing.nix {inherit config pkgs username;})
@@ -62,6 +61,7 @@ in {
../home/htop.nix
../home/neovim.nix
(import ../home/rbw.nix {inherit pkgs domain email;})
+ (import ../home/rclone.nix {inherit domain username sshport privatekey;})
(import ../home/ssh.nix {inherit domain username sshport privatekey;})
];
# The state version is required and should stay at the version you
diff --git a/scripts/phone-dump.nix b/scripts/phone-dump.nix
@@ -2,7 +2,6 @@
phone-dump = pkgs.writeShellScriptBin "phone-dump" ''
# variables
phone_remote=phone
- phone_ip=$(grep -A4 "$phone_remote" "$(rclone config file | tail -1)" | awk '/host/ {print $3}')
destination="/mnt/pictures/personal"
if [ ! -d "$destination" ]; then
echo "Destination $destination does not exist."
@@ -10,10 +9,10 @@
fi
# if ping phone
- if ping -c 1 "$phone_ip" &>/dev/null; then
+ if ping -c 1 "$phone_remote" &>/dev/null; then
echo "Phone reachable, mounting remote"
directory_temp="$(mktemp -d)"
- rclone mount "$phone_remote": "$directory_temp" --daemon
+ ${pkgs.rclone}/bin/rclone mount "$phone_remote": "$directory_temp" --daemon
cd "$directory_temp" || exit
declare -a directories=(