Add p command to paste files
This commit is contained in:
parent
c8ca5adf84
commit
9b1391a9f6
@ -18,6 +18,7 @@
|
||||
./msmtp.nix
|
||||
./postgresql.nix
|
||||
./nginx.nix
|
||||
./p.nix
|
||||
#./pxe.nix
|
||||
];
|
||||
|
||||
|
22
m/hut/p.nix
Normal file
22
m/hut/p.nix
Normal 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 ];
|
||||
}
|
Loading…
Reference in New Issue
Block a user