From b97e01169ed753e3cc7b4b09ce3bf3537b6f638a Mon Sep 17 00:00:00 2001 From: Profpatsch Date: Tue, 2 Jun 2020 21:52:05 +0200 Subject: pkgs/profpatsch: add binify helper --- pkgs/profpatsch/default.nix | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'pkgs') diff --git a/pkgs/profpatsch/default.nix b/pkgs/profpatsch/default.nix index d4ce9ad8..dd463039 100644 --- a/pkgs/profpatsch/default.nix +++ b/pkgs/profpatsch/default.nix @@ -17,6 +17,20 @@ let }; in builtins.listToAttrs (builtins.map f xs); + # Create a store path where the executable `exe` + # is linked to $out/bin/${name}. + # This is useful for e.g. including it as a “package” + # in `buildInputs` of a shell.nix. + # + # For example, if I have the exeutable /nix/store/…-hello, + # I can make it into /nix/store/…-binify-hello/bin/hello + # with `binify { exe = …; name = "hello" }`. + binify = { exe, name }: + pkgs.runCommandLocal "binify-${name}" {} '' + mkdir -p $out/bin + ln -sT ${lib.escapeShellArg exe} $out/bin/${lib.escapeShellArg name} + ''; + exactSource = import ./exact-source.nix; # various nix utils and fun experiments @@ -154,7 +168,7 @@ in rec { inherit (import ./execline/e.nix { inherit pkgs writeExecline getBins; }) e; - inherit getBins; + inherit getBins binify; inherit (import ./sandbox.nix {inherit pkgs writeExecline; }) sandbox runInEmptyEnv; -- cgit 1.4.1