Archived
1
0
forked from rarias/bscpkgs

Add p command to paste files

Reviewed-by: Aleix Boné <abonerib@bsc.es>
This commit is contained in:
2024-09-16 16:33:42 +02:00
parent fce4d89e1d
commit 9ea7b2b475
3 changed files with 28 additions and 0 deletions

24
m/hut/p.nix Normal file
View File

@@ -0,0 +1,24 @@
{ pkgs, ... }:
let
p = pkgs.writeShellScriptBin "p" ''
set -e
cd /ceph
pastedir="p/$USER"
mkdir -p "$pastedir"
ext="txt"
if [ -n "$1" ]; then
ext="$1"
fi
out=$(mktemp "$pastedir/XXXXXXXX.$ext")
cat > "$out"
chmod go+r "$out"
echo "https://jungle.bsc.es/$out"
'';
in
{
environment.systemPackages = with pkgs; [ p ];
}