stockholm/krebs/5pkgs/simple/cyberlocker-tools/default.nix

24 lines
522 B
Nix
Raw Normal View History

2021-08-29 12:00:18 +00:00
{ pkgs }:
pkgs.symlinkJoin {
name = "cyberlocker-tools";
paths = [
(pkgs.writers.writeDashBin "cput" ''
set -efu
path=''${1:-$(hostname)}
2021-08-31 20:44:27 +00:00
path=$(echo "/$path" | sed -E 's:/+:/:')
url=http://c.r$path
2021-08-29 12:00:18 +00:00
2021-08-31 20:44:27 +00:00
${pkgs.curl}/bin/curl -fSs --data-binary @- "$url"
echo "$url"
2021-08-29 12:00:18 +00:00
'')
(pkgs.writers.writeDashBin "cdel" ''
set -efu
path=$1
2021-08-31 20:44:27 +00:00
path=$(echo "/$path" | sed -E 's:/+:/:')
url=http://c.r$path
2021-08-29 12:00:18 +00:00
2021-08-31 20:44:27 +00:00
${pkgs.curl}/bin/curl -f -X DELETE "$url"
2021-08-29 12:00:18 +00:00
'')
];
}