Restic Backups on B2 with NixOS+agenix

Hi everyone,

I recently automated my restic backups in NixOS and wrote a blog post about it. It also includes a short section about agenix and desktop notifications with libnotify (in case a backup fails). I’ve been using NixOS as my main OS on my desktop pc for a year now. This post is aimed at beginners like me who want to have something to get started with.

https://www.arthurkoziel.com/restic-backups-b2-nixos/

I’d appreciate any feedback! For example if the code can be improved, or there are better solutions for this, or maybe the writing is not clear enough.

Thanks!

9 Likes

Welcome to NixOS discourse! And thanks for the blog post. First feedback I will give is that this appears to be an interesting topic and I will surely read it. :smiley:

2 Likes

During the “Testing Backup Restore” Part, you can skip needing to set the Environment Variables if you are using unstable/23.11.
nixos/restic: add wrapper scripts that set parameters for backup by ajs124 · Pull Request #251062 · NixOS/nixpkgs · GitHub introduced a Wrapper that automatically sets everything up.

The new commands would then just be:

$ restic-daily snapshots

and

$ restic-daily restore --target restore-backup latest
4 Likes

This was a great addition! The only thing that doesn’t work yet is doing restic mount because fusermount isn’t in the $PATH for the wrapper.

1 Like

I’ve updated to 23.11 today and tried the wrapper. It works great, very useful addition. I’ve updated the blog post to restore backups using the wrapper.

2 Likes