From c2a8221c7fe1bada01a45814b1d2829accbb2189 Mon Sep 17 00:00:00 2001 From: Crony Akatsuki Date: Sat, 30 Mar 2024 17:29:13 +0100 Subject: [PATCH] Add new script and it's dependencies. --- home-manager/modules/scripts.nix | 4 ++++ home-manager/modules/scripts/sync-backup | 13 +++++++++++++ 2 files changed, 17 insertions(+) create mode 100755 home-manager/modules/scripts/sync-backup 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