nixpkgs/home/packages/custom/backup/default.nix
Daniel Siepmann bb64b6d859
Streamline push etckeeper and os update
The os update and backup now include etckeeper as its part of the
workflow.
The os updates now have the same name on all systems. That should reduce
friction, same command for same workflow, just different implementation.
2023-03-16 08:38:16 +01:00

37 lines
692 B
Nix

{
writeShellApplication
, borgbackup
, git
, rsync
, callPackage
}:
writeShellApplication {
name = "custom-backup";
runtimeInputs = [
borgbackup
rsync
git
(callPackage ../push-etckeeper { })
];
text = ''
borg create \
-v \
--progress \
--stats \
--exclude-from ~/.config/borg/exclude \
/media/daniels/Backup/borg::"$(date +%F-%R)" \
~/
rsync -az --delete ~/.config/nixpkgs /media/daniels/Backup/
sudo 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
custom-push-etckeeper
'';
}