From 9d33f42d3fac1597a56ce890d629774b52682686 Mon Sep 17 00:00:00 2001 From: Guanran Wang Date: Wed, 5 Jun 2024 17:51:01 +0800 Subject: [PATCH] home: use selfhosted wastebin --- home/default.nix | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/home/default.nix b/home/default.nix index 88220da..8b092c1 100644 --- a/home/default.nix +++ b/home/default.nix @@ -57,4 +57,15 @@ ".." = "cd .."; "farsee" = "curl -F 'c=@-' 'https://fars.ee/'"; # pb }; + + programs.fish.functions = { + "pb" = let + jq = lib.getExe pkgs.jq; + curl = lib.getExe pkgs.curl; + in '' + ${jq} -Rns '{text: inputs}' | \ + ${curl} -s -H 'Content-Type: application/json' --data-binary @- https://pb.ny4.dev | \ + ${jq} -r '. | "https://pb.ny4.dev\(.path)"' + ''; + }; }