about summary refs log tree commit diff
path: root/home/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'home/scripts')
-rw-r--r--home/scripts/bc-to-nas.nix14
-rw-r--r--home/scripts/default.nix2
2 files changed, 15 insertions, 1 deletions
diff --git a/home/scripts/bc-to-nas.nix b/home/scripts/bc-to-nas.nix
new file mode 100644
index 0000000..efa95d2
--- /dev/null
+++ b/home/scripts/bc-to-nas.nix
@@ -0,0 +1,14 @@
+{ lib, pkgs, ... }:
+let
+  bc-to-nas = pkgs.writeShellScriptBin "bc-to-nas" ''
+    set -euo pipefail
+
+    ALBUM_PATH="''${1}"
+    ALBUM_NAME=$(basename "''${ALBUM_PATH}")
+    NAS=$(${pkgs.tailscale}/bin/tailscale status --json | ${pkgs.jq}/bin/jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]')
+
+    scp "''${ALBUM_PATH}" "''${NAS}:~/import/album.zip"
+    ssh "''${NAS}" bc-to-beet ~/import/album.zip
+  '';
+in
+{ config = { home.packages = with pkgs; [ bc-to-nas ]; }; }
diff --git a/home/scripts/default.nix b/home/scripts/default.nix
index bc19e44..741bade 100644
--- a/home/scripts/default.nix
+++ b/home/scripts/default.nix
@@ -1,5 +1,5 @@
 { ... }:
 
 {
-  imports = [ ./perf-flamegraph.nix ];
+  imports = [ ./perf-flamegraph.nix ./bc-to-nas.nix ];
 }