diff --git a/flake.nix b/flake.nix index 96e28ad..c5f4cb0 100644 --- a/flake.nix +++ b/flake.nix @@ -70,6 +70,7 @@ "steam" "steam-unwrapped" "cheatsheet.nvim" + "zoom-us" "zoom" ]; mkUnfreePredicate = pkg: builtins.elem (inputs.nixpkgs.lib.getName pkg) unfreePkgs; diff --git a/modules/applications/hyprland.nix b/modules/applications/hyprland.nix index d851950..99685ed 100644 --- a/modules/applications/hyprland.nix +++ b/modules/applications/hyprland.nix @@ -53,6 +53,19 @@ monitor = [ ", highres@highrr, auto, 0.75" ]; + exec-once = [ + "if [ -e \"/home/tomasr/icloudSync.sh\" ]; then /home/tomasr/icloudSync.sh; else notify-send \"icloudSync.sh doesn't exist\" \"See ~/nixos/modules/applications/hyprland.nix for more information\"; fi" + # my icloud account uses an email that I don't want to make public. So the script isnt pushed to github. The script looks like: + /* + #!/etc/profiles/per-user/tomasr/bin/zsh + if ! icloudpd --auth-only --username tomas.rivera_2009@icloud.com --dry-run; then + notify-send "icloudpd is not logged in" "Please run icloudpd icloudpd --username my@email.address --password my_password --auth-only" + exit 1 + fi + icloudpd --directory ~/hdd/kdrive/Photo/IPhone/icloudpd-backup --username tomas.rivera_2009@icloud.com --watch-with-interval 3600 --no-progress-bar + */ + + ]; }; }; flake.homeModules.hyprland = {pkgs-unstable, ...}: let diff --git a/modules/applications/kdrive.nix b/modules/applications/kdrive.nix index d432f13..f34b115 100644 --- a/modules/applications/kdrive.nix +++ b/modules/applications/kdrive.nix @@ -11,11 +11,12 @@ enable = true; }; }; - flake.nixosModules.kdrive-desktop = {pkgs, ...}: { - environment.systemPackages = [ - pkgs.rclone - self.packages.${pkgs.system}.custom-checkKdrive - self.packages.${pkgs.system}.custom-synckdrive-desktop + flake.nixosModules.kdrive-desktop = {pkgs-unstable, ...}: { + environment.systemPackages = with pkgs-unstable; [ + rclone + icloudpd + self.packages.${pkgs-unstable.system}.custom-checkKdrive + self.packages.${pkgs-unstable.system}.custom-synckdrive-desktop ]; # removes rclone error programs.fuse = { @@ -24,7 +25,7 @@ }; systemd.user.services.kdrive-sync = { serviceConfig = { - ExecStart = "${self.packages.${pkgs.system}.custom-synckdrive-desktop}/bin/custom-synckdrive"; + ExecStart = "${self.packages.${pkgs-unstable.system}.custom-synckdrive-desktop}/bin/custom-synckdrive"; Nice = 19; # lowest CPU scheduling priority IOSchedulingClass = "idle"; @@ -34,15 +35,13 @@ CPUWeight = 1; # minimum relative CPU share }; }; - /* systemd.user.timers.kdrive-sync = { wantedBy = [ "timers.target" ]; timerConfig = { - OnBootSec = "1m"; - OnUnitActiveSec = "5m"; + OnBootSec = "10m"; + OnUnitActiveSec = "1h"; }; }; - */ }; perSystem = {pkgs, ...}: { packages.custom-checkKdrive = pkgs.writeShellApplication { @@ -115,18 +114,25 @@ runtimeInputs = with pkgs; [ rclone libnotify + ripgrep ]; text = '' REMOTE_NAME="kdrive" MOUNT_POINT="/home/tomasr/hdd/kdrive" - - if rclone listremotes | rg "^''${REMOTE_NAME}:"; then + LOGFILE="/tmp/rclone-bisync.log" + rm LOGFILE && touch LOGFILE + if rclone --config "$HOME/.config/rclone/rclone.conf" listremotes | rg "^''${REMOTE_NAME}:"; then echo "Syncing ''${REMOTE_NAME}..." - rclone bisync "''${REMOTE_NAME}:" "$MOUNT_POINT" & + if ! rclone --config "$HOME/.config/rclone/rclone.conf" bisync "$MOUNT_POINT" "$REMOTE_NAME:" --recover > "$LOGFILE" 2>&1; then + notify-send "rclone bisync failed" "$(cat $LOGFILE)" + echo "rclone bisync failed" + cat $LOGFILE + cp $LOGFILE "$HOME/hdd/kdrive/logs/$(date +%Y-%m-%d-%H-%M-%S).log" + fi 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." + echo "Remote ''${REMOTE_NAME} not found. Configure rclone or fix in ~/nixos/modules/applications/kdrive.nix" fi ''; }; diff --git a/modules/utilities/communicationAndNotification.nix b/modules/utilities/communicationAndNotification.nix index a9b845e..21506e4 100644 --- a/modules/utilities/communicationAndNotification.nix +++ b/modules/utilities/communicationAndNotification.nix @@ -11,6 +11,7 @@ self.packages.${pkgs.system}.custom-checkMatrix self.packages.${pkgs.system}.custom-gitnotify # checks if git is set up self.packages.${pkgs.system}.custom-checkKdrive # check if kdrive is set up with rclone + zoom-us ]; }; perSystem = {pkgs, ...}: { diff --git a/modules/utilities/gitBackup.nix b/modules/utilities/gitBackup.nix index 08f9070..09561be 100644 --- a/modules/utilities/gitBackup.nix +++ b/modules/utilities/gitBackup.nix @@ -54,7 +54,9 @@ "https://github.com/tomasriveral/notewrapper.git" "https://github.com/tomasriveral/fractal-cli.git" "https://github.com/tomasriveral/boids.git" - "https://github.com/tomasriveral/Nixpkgs-tracker-notifier.git" + "https://github.com/tomasriveral/nixpkgs-notifier.git" + "https://github.com/tomasriveral/Nix-Git-Cherry-Picker.git" + "https://github.com/tomasriveral/ReSSPublica.git" ) LOCAL_BACKUP_DIR="$HOME/.gitBackups"