about summary refs log tree commit diff
path: root/users/Profpatsch/lib.nix
diff options
context:
space:
mode:
Diffstat (limited to 'users/Profpatsch/lib.nix')
-rw-r--r--users/Profpatsch/lib.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/users/Profpatsch/lib.nix b/users/Profpatsch/lib.nix
new file mode 100644
index 000000000000..8120a01d5bce
--- /dev/null
+++ b/users/Profpatsch/lib.nix
@@ -0,0 +1,23 @@
+{ depot, pkgs, ... }:
+let
+  bins = depot.nix.getBins pkgs.coreutils ["printf" "echo"];
+
+  debugExec = msg: depot.nix.writeExecline "debug-exec" {} [
+    "if" [
+      "fdmove" "-c" "1" "2"
+      "if" [ bins.printf "%s: " msg ]
+      "if" [ bins.echo "$@" ]
+    ]
+    "$@"
+  ];
+
+  eprintf = depot.nix.writeExecline "eprintf" {} [
+    "fdmove" "-c" "1" "2" bins.printf "%s" "$@"
+  ];
+
+in {
+  inherit
+    debugExec
+    eprintf
+    ;
+}