about summary refs log tree commit diff
path: root/users/Profpatsch/lib.nix
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-01-17T11·32+0100
committerProfpatsch <mail@profpatsch.de>2021-01-17T11·37+0000
commit80e1ece32931530a0a024db9828d197f3fdb1951 (patch)
tree0a98a447b56c1c4d897025a7ff1ad73eecebdfd5 /users/Profpatsch/lib.nix
parentf8b3e2a100fdb28cad24948703439d2964c31580 (diff)
feat(users/Profpatsch): set up a file watcher for tree sitter r/2121
Uses inotify to watch a file and print when it is modified, so we can
update the parser and display the sexp on the terminal.

Now the setup is good enough to start experiementing with queries on
the syntax tree.

Change-Id: I091587fc495ff627c79a69a52915aaaa8c51fcd2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/2411
Tested-by: BuildkiteCI
Reviewed-by: Profpatsch <mail@profpatsch.de>
Diffstat (limited to 'users/Profpatsch/lib.nix')
-rw-r--r--users/Profpatsch/lib.nix14
1 files changed, 13 insertions, 1 deletions
diff --git a/users/Profpatsch/lib.nix b/users/Profpatsch/lib.nix
index 69e6f73e408a..9215f5b19c77 100644
--- a/users/Profpatsch/lib.nix
+++ b/users/Profpatsch/lib.nix
@@ -1,6 +1,8 @@
 { depot, pkgs, ... }:
 let
-  bins = depot.nix.getBins pkgs.coreutils ["printf" "echo"];
+  bins = depot.nix.getBins pkgs.coreutils [ "printf" "echo" "cat" "printenv" ]
+      // depot.nix.getBins pkgs.fdtools [ "multitee" ]
+      ;
 
   debugExec = msg: depot.nix.writeExecline "debug-exec" {} [
     "if" [
@@ -15,9 +17,19 @@ let
     "fdmove" "-c" "1" "2" bins.printf "$@"
   ];
 
+  eprint-stdin = depot.nix.writeExecline "eprint-stdin" {} [
+    "pipeline" [ bins.multitee "0-1,2" ] "$@"
+  ];
+
+  eprintenv = depot.nix.writeExecline "eprintenv" { readNArgs = 1; } [
+    "fdmove" "-c" "1" "2" bins.printenv "$1"
+  ];
+
 in {
   inherit
     debugExec
     eprintf
+    eprint-stdin
+    eprintenv
     ;
 }