Add p command to paste files

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

View File

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

View File

@ -55,6 +55,9 @@ in
autoindex on;
absolute_redirect off;
}
location /p/ {
alias /ceph/p/;
}
'';
};
};

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 ];
}