nixpkgs/home/packages/custom/backup/default.nix
Daniel Siepmann 21573b25f5
Ease writeShellApplication calls
Provide proper runtimeInputs instead of using nix variables all the
time.
2022-05-31 18:54:47 +02:00

34 lines
611 B
Nix

{
writeShellApplication,
borgbackup,
git,
rsync
}:
writeShellApplication {
name = "custom-backup";
runtimeInputs = [
borgbackup
rsync
git
];
text = ''
borg create \
-v \
--progress \
--stats \
--exclude-from ~/.config/borg/exclude \
/media/daniels/Backup/borg::"$(date +%F-%R)" \
~/
rsync -az ~/.config/nixpkgs /media/daniels/Backup/
sudo ${rsync}/bin/rsync -az /etc/.git /media/daniels/Backup/etc/
sudo chown daniels:daniels -R /media/daniels/Backup/etc/
cd /media/daniels/Backup/etc/
git reset --hard master
'';
}