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/nix-tools.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 pkgs/profpatsch/nix-tools.nix (limited to 'pkgs/profpatsch/nix-tools.nix') diff --git a/pkgs/profpatsch/nix-tools.nix b/pkgs/profpatsch/nix-tools.nix new file mode 100644 index 00000000..9b6eb339 --- /dev/null +++ b/pkgs/profpatsch/nix-tools.nix @@ -0,0 +1,18 @@ +{ pkgs, writeExecline, backtick, runblock, getBins }: + +let + bins = getBins pkgs.nix [ "nix-build" ]; + + nix-run = writeExecline "nix-run" { argMode = "env"; } [ + (backtick { + var = "storepath"; + cmd = [ runblock "1" bins.nix-build ]; + }) + runblock "-r" "2" "exec" "$storepath" + ]; + +in { + inherit + nix-run + ; +} -- cgit 1.4.1