mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
Auto: cleanup-2026-05-24T10-18-36Z
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{ self, ... }: {
|
||||
flake.nixosModules.kdrive = { pkgs-unstable, ... }: {
|
||||
{self, ...}: {
|
||||
flake.nixosModules.kdrive = {pkgs-unstable, ...}: {
|
||||
environment.systemPackages = with pkgs-unstable; [
|
||||
rclone
|
||||
self.packages.${pkgs.system}.custom-checkKdrive
|
||||
@@ -11,7 +11,7 @@
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
perSystem = { pkgs, ... }: {
|
||||
perSystem = {pkgs, ...}: {
|
||||
packages.custom-checkKdrive = pkgs.writeShellApplication {
|
||||
name = "custom-checkKdrive";
|
||||
runtimeInputs = with pkgs; [
|
||||
@@ -20,21 +20,21 @@
|
||||
libnotify
|
||||
];
|
||||
text = ''
|
||||
|
||||
|
||||
# waits for an internet connection. It pings both Google DNS and Cloudfare dns in case one of them is down
|
||||
until ping -c1 -W1 1.1.1.1 >/dev/null 2>&1 || \
|
||||
ping -c1 -W1 8.8.8.8 >/dev/null 2>&1
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
||||
set +e
|
||||
|
||||
|
||||
output=$(rclone lsd kdrive: 2>&1)
|
||||
status=$?
|
||||
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
if [ $status -eq 0 ]; then
|
||||
echo "kdrive OK"
|
||||
else
|
||||
@@ -47,23 +47,24 @@
|
||||
'';
|
||||
};
|
||||
packages.custom-mountkdrive = pkgs.writeShellApplication {
|
||||
name = "custom-mountkdrive";
|
||||
runtimeInputs = with pkgs; [
|
||||
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 --allow-non-empty &
|
||||
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
|
||||
'';
|
||||
name = "custom-mountkdrive";
|
||||
runtimeInputs = with pkgs; [
|
||||
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 --allow-non-empty &
|
||||
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
|
||||
'';
|
||||
};
|
||||
};
|
||||
};}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user