mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 02:28:37 +02:00
Added a script that backups obsidian notes
This commit is contained in:
@@ -78,6 +78,7 @@
|
|||||||
(pkgs.callPackage ../../modules/scripts/manix.nix {})
|
(pkgs.callPackage ../../modules/scripts/manix.nix {})
|
||||||
(pkgs.callPackage ../../modules/scripts/man.nix {})
|
(pkgs.callPackage ../../modules/scripts/man.nix {})
|
||||||
(pkgs.callPackage ../../modules/scripts/trimmer.nix {})
|
(pkgs.callPackage ../../modules/scripts/trimmer.nix {})
|
||||||
|
(pkgs.callPackage ../../modules/scripts/obsidianbackup.nix {}) # periodically syncs obsidian's note to kdrive
|
||||||
(pkgs.callPackage ../../modules/scripts/QSsysinfo.nix {})
|
(pkgs.callPackage ../../modules/scripts/QSsysinfo.nix {})
|
||||||
(pkgs.callPackage ../../modules/scripts/QSnotifycache.nix {})
|
(pkgs.callPackage ../../modules/scripts/QSnotifycache.nix {})
|
||||||
(pkgs.callPackage ../../modules/scripts/QSnotifyhistory.nix {})
|
(pkgs.callPackage ../../modules/scripts/QSnotifyhistory.nix {})
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ in {
|
|||||||
"custom-mountkdrive"
|
"custom-mountkdrive"
|
||||||
#"waybar"
|
#"waybar"
|
||||||
"custom-gitnotify"
|
"custom-gitnotify"
|
||||||
|
"custom-obsidianbackup" # backups the obsidian notes to kdrive and to a timed hidden dir (~/.Notes.backup/)
|
||||||
"QS-notifycache" # builds the cache that will be used for the notification history
|
"QS-notifycache" # builds the cache that will be used for the notification history
|
||||||
|
|
||||||
#########################
|
#########################
|
||||||
@@ -353,8 +354,8 @@ in {
|
|||||||
"2, layout:scrolling, layoutopt:direction:right"
|
"2, layout:scrolling, layoutopt:direction:right"
|
||||||
"name:special, layout:scrolling"
|
"name:special, layout:scrolling"
|
||||||
# used for smart gaps along some windowrules
|
# used for smart gaps along some windowrules
|
||||||
"w[tv1], gapsout:0, gapsin:0"
|
"w[tv1], gapsout:1, gapsin:1"
|
||||||
"f[1], gapsout:0, gapsin:0"
|
"f[1], gapsout:1, gapsin:1"
|
||||||
];
|
];
|
||||||
|
|
||||||
# █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█ █▀█ █░█ █░░ █▀▀ █▀
|
# █░█░█ █ █▄░█ █▀▄ █▀█ █░█░█ █▀█ █░█ █░░ █▀▀ █▀
|
||||||
@@ -415,10 +416,10 @@ in {
|
|||||||
"float on, size 400 175, match:class ^(custom-librewolfprofiles)$"
|
"float on, size 400 175, match:class ^(custom-librewolfprofiles)$"
|
||||||
"float on, size 600 600, match:initial_class ^(custom-pomodoro)$"
|
"float on, size 600 600, match:initial_class ^(custom-pomodoro)$"
|
||||||
"float on, size 1500 800, match:initial_class ^(custom-bottom)$"
|
"float on, size 1500 800, match:initial_class ^(custom-bottom)$"
|
||||||
"border_size 0, match:float 0, match:workspace w[tv1]"
|
"border_size 2, match:float 0, match:workspace w[tv1]"
|
||||||
"rounding 0, match:float 0, match:workspace w[tv1]"
|
"rounding 1, match:float 0, match:workspace w[tv1]"
|
||||||
"border_size 0, match:float 0, match:workspace f[1]"
|
"border_size 2, match:float 0, match:workspace f[1]"
|
||||||
"rounding 0, match:float 0, match:workspace f[1]"
|
"rounding 1, match:float 0, match:workspace f[1]"
|
||||||
];
|
];
|
||||||
# add a float for tomato when in kitty
|
# add a float for tomato when in kitty
|
||||||
#"plugin:imgborders:noimgborders, tag:noborder"
|
#"plugin:imgborders:noimgborders, tag:noborder"
|
||||||
|
|||||||
@@ -7,7 +7,14 @@
|
|||||||
enable = true;
|
enable = true;
|
||||||
vaults.miscellanious = {
|
vaults.miscellanious = {
|
||||||
enable = true;
|
enable = true;
|
||||||
#target = "/kdrive/Notes/miscellanious"; #not directly to kdrive. It causes problems
|
target = "/Documents/Notes/miscellanious"; # target is relative to ~ #not directly to kdrive. It causes problems
|
||||||
|
};
|
||||||
|
vaults.work = {
|
||||||
|
enable = true;
|
||||||
|
target = "/Documents/Notes/work";
|
||||||
|
};
|
||||||
|
defaultSettings = {
|
||||||
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
writeShellApplication,
|
||||||
|
rclone,
|
||||||
|
libnotify,
|
||||||
|
rsync,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
writeShellApplication {
|
||||||
|
name = "custom-obsidianbackup";
|
||||||
|
runtimeInputs = [
|
||||||
|
rclone
|
||||||
|
libnotify
|
||||||
|
rsync
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
SOURCE_DIR="$HOME/Documents/Notes"
|
||||||
|
DEST_DIR="$HOME/kdrive/Notes"
|
||||||
|
BACKUP_DIR="$HOME/.Notes.backup"
|
||||||
|
|
||||||
|
mkdir -p "$DEST_DIR"
|
||||||
|
mkdir -p "$BACKUP_DIR"
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
# Timestamp for this run
|
||||||
|
TIMESTAMP=$(date +%Y-%m-%d_%H-%M)
|
||||||
|
TIMESTAMPED_BACKUP="$BACKUP_DIR/$TIMESTAMP"
|
||||||
|
mkdir -p "$TIMESTAMPED_BACKUP"
|
||||||
|
|
||||||
|
echo "[$(date)] Starting Obsidian backup..."
|
||||||
|
|
||||||
|
# Check rclone mount
|
||||||
|
status=$(rclone about kdrive: 2>&1 || true)
|
||||||
|
if [[ "$status" =~ .*CRITICAL.* ]]; then
|
||||||
|
echo "[$(date)] rclone failed:"
|
||||||
|
echo "$status"
|
||||||
|
notify-send -u critical "rclone failed" \
|
||||||
|
"rclone might be broken or you need to deactivate this script in HomeManager."
|
||||||
|
else
|
||||||
|
# Run rsync with verbose debugging
|
||||||
|
echo "[$(date)] Running rsync..."
|
||||||
|
rsync -Lavh --progress --update --backup --backup-dir="$TIMESTAMPED_BACKUP" \
|
||||||
|
--exclude='.obsidian/cache/**' \
|
||||||
|
"$SOURCE_DIR/" "$DEST_DIR/"
|
||||||
|
|
||||||
|
echo "[$(date)] Backup completed for this run."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Safely remove backups older than 30 days
|
||||||
|
if [[ -d "$BACKUP_DIR" && "$BACKUP_DIR" == "$HOME/.Notes.backup" ]]; then
|
||||||
|
echo "[$(date)] Cleaning old backups..."
|
||||||
|
find "$BACKUP_DIR/" -mindepth 1 -maxdepth 1 -type d -mtime +30 -exec rm -rf {} \;
|
||||||
|
else
|
||||||
|
echo "[$(date)] Backup directory not safe. Skipping cleanup."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Wait 1 hour
|
||||||
|
echo "[$(date)] Sleeping for 1 hour..."
|
||||||
|
sleep 3600
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -1,20 +1,12 @@
|
|||||||
audacity.x86_64
|
audacity.x86_64
|
||||||
biber.noarch
|
|
||||||
dolphin.x86_64 may be customized or nautilus cust
|
dolphin.x86_64 may be customized or nautilus cust
|
||||||
ollama.x86_64
|
ollama.x86_64
|
||||||
plymouth.x86_64
|
plymouth.x86_64
|
||||||
python3.x86_64
|
|
||||||
qt6-qtwebsockets.x86_64 maybe copy from rivendel hy
|
|
||||||
quickshell.x86_64
|
quickshell.x86_64
|
||||||
raylib-devel.x86_64
|
raylib-devel.x86_64
|
||||||
some notification daemon 0.12-32.fc43
|
some notification daemon 0.12-32.fc43
|
||||||
texlive.noarch
|
|
||||||
texlive-biblatex.noarch
|
|
||||||
texlive-bibtex.x86_64
|
|
||||||
thunderbird.x86_64
|
|
||||||
tor.x86_64
|
tor.x86_64
|
||||||
torbrowser-launcher.noarch
|
torbrowser-launcher.noarch
|
||||||
replace sddm by ly
|
|
||||||
maybe configure a bit ripgrep? majuscules
|
maybe configure a bit ripgrep? majuscules
|
||||||
|
|
||||||
|
|
||||||
@@ -61,6 +53,8 @@ with quickshell:
|
|||||||
|
|
||||||
maybe some kind of overview?
|
maybe some kind of overview?
|
||||||
|
|
||||||
|
show battery percentage
|
||||||
|
|
||||||
see what people did with quickshell and take inspiration
|
see what people did with quickshell and take inspiration
|
||||||
|
|
||||||
work on quickshell color palette to match gruvbox
|
work on quickshell color palette to match gruvbox
|
||||||
|
|||||||
Reference in New Issue
Block a user