diff options
author | Profpatsch <mail@profpatsch.de> | 2021-01-01 12:27:20 +0100 |
---|---|---|
committer | Profpatsch <mail@profpatsch.de> | 2021-01-01 12:27:20 +0100 |
commit | b5015b5865d8e8f8b64f99746a571b708e9b776f (patch) | |
tree | 55087666a194b810f8848ba539118f6354092cd9 /pkgs/profpatsch/nix-tools.nix | |
parent | 47a8bf4dd2cb1f6778b38bc2f4990ba72366d5a9 (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/nix-tools.nix')
-rw-r--r-- | pkgs/profpatsch/nix-tools.nix | 18 |
1 files changed, 18 insertions, 0 deletions
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 + ; +} |