aboutsummaryrefslogtreecommitdiff
path: root/home/packages
diff options
context:
space:
mode:
Diffstat (limited to 'home/packages')
-rw-r--r--home/packages/default.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/home/packages/default.nix b/home/packages/default.nix
index 6a67129..fbf258f 100644
--- a/home/packages/default.nix
+++ b/home/packages/default.nix
@@ -11,6 +11,21 @@ let
scp "''${ALBUM_PATH}" "''${NAS}:~/import/album.zip"
ssh "''${NAS}" bc-to-beet ~/import/album.zip
'';
+
+ restic-nas = pkgs.writeShellApplication
+ {
+ name = "restic-nas";
+ runtimeInputs = [ pkgs.restic pkgs.tailscale pkgs.jq ];
+ text = ''
+ NAS=$(tailscale status --json | jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]')
+
+ RESTIC_REPOSITORY="sftp:''${NAS}:/$(hostname)"
+ export RESTIC_REPOSITORY
+ export RESTIC_PASSWORD_FILE=/run/agenix/restic/repo-users
+
+ sudo -E restic -o sftp.command="ssh backup@''${NAS} -i /run/agenix/restic/ssh-key -s sftp" "$@"
+ '';
+ };
in
{
options.my.home.packages = with lib; {
@@ -36,6 +51,7 @@ in
# custom tools
album-to-nas
+ restic-nas
# tools inside the tools directory
tools.gha-billing