From b5015b5865d8e8f8b64f99746a571b708e9b776f Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Fri, 1 Jan 2021 12:27:20 +0100 Subject: 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`. --- pkgs/profpatsch/execline/nixecline.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 pkgs/profpatsch/execline/nixecline.nix (limited to 'pkgs/profpatsch/execline') 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; +} -- cgit 1.4.1