diff options
Diffstat (limited to 'home/packages')
-rw-r--r-- | home/packages/default.nix | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/home/packages/default.nix b/home/packages/default.nix index fbf258f..e6e4a5b 100644 --- a/home/packages/default.nix +++ b/home/packages/default.nix @@ -1,17 +1,19 @@ { config, lib, pkgs, ... }: let cfg = config.my.home.packages; - album-to-nas = pkgs.writeShellScriptBin "album-to-nas" '' - set -euo pipefail + album-to-nas = pkgs.writeShellApplication { + name = "album-to-nas"; + runtimeInputs = [ pkgs.jq pkgs.tailscale ]; + text = '' + ALBUM_PATH="''${1}" + ALBUM_NAME=$(basename "''${ALBUM_PATH}") - 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 - ''; + NAS=$(tailscale status --json | 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 + ''; + }; restic-nas = pkgs.writeShellApplication { name = "restic-nas"; |