nix-configs

Personal NixOS and home-manager configuration files
Log | Files | Refs

seedy.nix (523B)


      1 { pkgs, ... }:
      2 
      3 let
      4   seedy = pkgs.writeShellScriptBin "seedy" ''
      5     # default remote, or specify via argument
      6     remote_default="seedbox:"
      7     remote="''${1:-$remote_default}"
      8     # variables
      9     selection="$(rclone lsf "$remote" | fzf)"
     10     if [[ -z "$selection" ]]; then
     11       echo "No files were selected, exiting."
     12       exit 1
     13     fi
     14     printf "Copying %s...\n" "$selection"
     15     ${pkgs.rclone}/bin/rclone copy "$remote""$selection" . --transfers=1 --progress
     16   '';
     17 in {
     18   environment.systemPackages = [ seedy ];
     19 }