Wanted to use agenix to encrypt rclone config. But to diffcult. Ended with a custom-mountkdrive which verifies the existence of the remote before launching

This commit is contained in:
Tomas Rivera
2026-02-27 16:53:50 +01:00
parent 8b1f877dd9
commit 30405baa2d
8 changed files with 45 additions and 78 deletions
+22
View File
@@ -0,0 +1,22 @@
{ writeShellApplication, rclone, libnotify, ... }:
writeShellApplication {
name = "custom-mountkdrive";
runtimeInputs = [
rclone
libnotify
];
text = ''
REMOTE_NAME="kdrive"
MOUNT_POINT="$HOME/kdrive"
if rclone listremotes | rg "^''${REMOTE_NAME}:"; then
echo "Mounting ''${REMOTE_NAME}..."
rclone mount "''${REMOTE_NAME}:" "$MOUNT_POINT" --vfs-cache-mode writes &
else
notify-send "rclone mount failed" \
"Remote ''${REMOTE_NAME} not found.\nConfigure rclone and create the dir ~/kdrive/ or comment out the exec line in hyprland.nix."
echo "Remote ''${REMOTE_NAME} not found. Configure rclone or comment out the exec line in hyprland.nix."
fi
'';
}