jungle/m/hut/p.nix

23 lines
393 B
Nix

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