desktop: add kdrive sync

This commit is contained in:
2026-06-04 18:46:14 +02:00
parent 8ee9c3f639
commit 9d4eb9b0a2
2 changed files with 52 additions and 1 deletions
+51
View File
@@ -11,6 +11,37 @@
enable = true; enable = true;
}; };
}; };
flake.nixosModules.kdrive-desktop = {pkgs-unstable, ...}: {
environment.systemPackages = with pkgs-unstable; [
rclone
self.packages.${pkgs.system}.custom-checkKdrive
self.packages.${pkgs.system}.custom-synckdrive-desktop
];
# removes rclone error
programs.fuse = {
userAllowOther = true;
enable = true;
};
systemd.user.services.kdrive-sync = {
serviceConfig = {
ExecStart = "${pkgs.rclone}/bin/rclone bisync ...";
Nice = 19; # lowest CPU scheduling priority
IOSchedulingClass = "idle";
IOSchedulingPriority = 7;
# Optional:
CPUWeight = 1; # minimum relative CPU share
};
};
/*systemd.user.timers.kdrive-sync = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "1m";
OnUnitActiveSec = "5m";
};
};*/
};
perSystem = {pkgs, ...}: { perSystem = {pkgs, ...}: {
packages.custom-checkKdrive = pkgs.writeShellApplication { packages.custom-checkKdrive = pkgs.writeShellApplication {
name = "custom-checkKdrive"; name = "custom-checkKdrive";
@@ -66,5 +97,25 @@
fi fi
''; '';
}; };
packages.custom-synckdrive-desktop = pkgs.writeShellApplication {
name = "custom-synckdrive";
runtimeInputs = with pkgs; [
rclone
libnotify
];
text = ''
REMOTE_NAME="kdrive"
MOUNT_POINT="/data/kdrive"
if rclone listremotes | rg "^''${REMOVE_NAME}:"; then
echo "Syncing ''${Syncing} ''${REMOVE_NAME}..."
rclone sync "''${REMOVE_NAME}:" "$MOUNT_POINT" --allow-non-empty &
else
notify-send "rclone sync 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
'';
};
}; };
} }
+1 -1
View File
@@ -30,7 +30,7 @@
#hardware-configuration-desktop #hardware-configuration-desktop
hyprland hyprland
IO IO
#kdrive-laptop # we will setup this later kdrive-desktop # we will setup this later
latex latex
ly ly
mullvad mullvad