summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs/simple/cyberlocker-tools/default.nix
blob: 6e6563fb16cedcdf67b51fce60a72d8b6c79a252 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ pkgs }:
pkgs.symlinkJoin {
  name = "cyberlocker-tools";
  paths = [
    (pkgs.writers.writeDashBin "cput" ''
      set -efu
      path=''${1:-$(hostname)}
      path=$(echo "/$path" | sed -E 's:/+:/:')
      url=http://c.r$path

      ${pkgs.curl}/bin/curl -fSs --data-binary @- "$url"
      echo "$url"
    '')
    (pkgs.writers.writeDashBin "cdel" ''
      set -efu
      path=$1
      path=$(echo "/$path" | sed -E 's:/+:/:')
      url=http://c.r$path

      ${pkgs.curl}/bin/curl -f -X DELETE "$url"
    '')
  ];
}