diff --git a/home-manager/modules/scripts.nix b/home-manager/modules/scripts.nix index aff3393..cec091e 100644 --- a/home-manager/modules/scripts.nix +++ b/home-manager/modules/scripts.nix @@ -26,5 +26,9 @@ stdenv.mkDerivation { # Add dependencies to the runtime for my iso2chd script wrapProgram $out/bin/iso2chd \ --prefix PATH : ${lib.makeBinPath [ mame-tools ]} + + # Add dependencies to the runtime for my sync-backup script + wrapProgram $out/bin/sync-backup \ + --prefix PATH : ${lib.makeBinPath [ rsync cryptsetup ]} ''; } diff --git a/home-manager/modules/scripts/sync-backup b/home-manager/modules/scripts/sync-backup new file mode 100755 index 0000000..9457348 --- /dev/null +++ b/home-manager/modules/scripts/sync-backup @@ -0,0 +1,13 @@ +#!/usr/bin/env sh + +disk="$1" + +sudo cryptsetup luksOpen "$disk" crypt + +sudo mount /dev/mapper/crypt "$HOME/Documents/drive" + +rsync -ahAXv --delete /home/crony/.local/backup/ /home/crony/Documents/drive/backup + +sudo umount "$HOME/Documents/drive" + +sudo cryptsetup luksClose /dev/mapper/crypt