Add p command to paste files

This commit is contained in:
Rodrigo Arias 2024-09-16 16:33:42 +02:00
parent c8ca5adf84
commit 9b1391a9f6
2 changed files with 23 additions and 0 deletions

View File

@ -18,6 +18,7 @@
./msmtp.nix ./msmtp.nix
./postgresql.nix ./postgresql.nix
./nginx.nix ./nginx.nix
./p.nix
#./pxe.nix #./pxe.nix
]; ];

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

@ -0,0 +1,22 @@
{ 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 ];
}