about summary refs log tree commit diff
path: root/pkgs/profpatsch/execline
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2021-01-01 12:27:20 +0100
committerProfpatsch <mail@profpatsch.de>2021-01-01 12:27:20 +0100
commitb5015b5865d8e8f8b64f99746a571b708e9b776f (patch)
tree55087666a194b810f8848ba539118f6354092cd9 /pkgs/profpatsch/execline
parent47a8bf4dd2cb1f6778b38bc2f4990ba72366d5a9 (diff)
pkgs/profpatsch: add nix-run
Small tool which takes a block of nix options that should produce a
script to run, and then calls the script with the rest of argv

    e nix-run { -A foobar } a b c

calls `nix-build -A foobar && ./result a b c`.
Diffstat (limited to 'pkgs/profpatsch/execline')
-rw-r--r--pkgs/profpatsch/execline/nixecline.nix16
1 files changed, 16 insertions, 0 deletions
diff --git a/pkgs/profpatsch/execline/nixecline.nix b/pkgs/profpatsch/execline/nixecline.nix
new file mode 100644
index 00000000..518bce2e
--- /dev/null
+++ b/pkgs/profpatsch/execline/nixecline.nix
@@ -0,0 +1,16 @@
+# wrappers around execline commands ensuring sane default behaviours
+{ writeExecline }:
+
+let
+  backtick = {
+    var,
+    cmd,
+    importVar ? [ "importas" "-ui" var var ]
+  }: writeExecline "nix-backtick" {}
+    ([ "backtick" "-in" var cmd ]
+    ++ importVar
+    ++ [ "$@" ]);
+
+in {
+ inherit backtick;
+}