🚀 add share bin
This commit is contained in:
parent
a552ecf755
commit
82fa6002f9
2 changed files with 23 additions and 1 deletions
|
@ -4,8 +4,9 @@ let
|
|||
cheat = import ./cheat.nix { inherit pkgs; };
|
||||
cycleSinks = import ./cycleSinks.nix { inherit pkgs; };
|
||||
protonge = import ./protonge.nix { inherit pkgs; };
|
||||
share = import ./share.nix { inherit pkgs; };
|
||||
sxhkdHelp = import ./sxhkdHelp.nix { inherit pkgs; };
|
||||
in {
|
||||
home-manager.users.moritz.home.packages =
|
||||
[ cycleSinks cheat sxhkdHelp protonge ];
|
||||
[ cheat cycleSinks protonge share sxhkdHelp ];
|
||||
}
|
||||
|
|
21
modules/cli/bin/share.nix
Normal file
21
modules/cli/bin/share.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "share";
|
||||
|
||||
runtimeInputs = with pkgs; [ curl coreutils rofi p7zip xclip ];
|
||||
|
||||
text = ''
|
||||
files="$(find "$HOME" -maxdepth 10 -type 'f' -not -path '*/.*' | rofi -dmenu -d 15 -p 'Files to share')"
|
||||
password="$(rofi -dmenu -p 'Password for encryption')"
|
||||
zipname="$HOME/Downloads/share-$(date +"%Y-%m-%d").zip"
|
||||
if [[ $password == "" ]]; then
|
||||
args=""
|
||||
else
|
||||
args="-p""$password"""
|
||||
fi
|
||||
7z a "$zipname" "$files" "$args" -mx9 > /dev/null
|
||||
curl -s -F"file=@$zipname" 0x0.st | xclip -sel c
|
||||
rm "$zipname"
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue