about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorProfpatsch <mail@profpatsch.de>2020-06-02 21:52:05 +0200
committerProfpatsch <mail@profpatsch.de>2020-06-02 21:52:05 +0200
commitb97e01169ed753e3cc7b4b09ce3bf3537b6f638a (patch)
tree15eea1e4517012d4e1f70cdf5443e36ffd28f488 /pkgs
parentc7aaf0b2c7c49b672e0ed5c52ad9003d41ef4af4 (diff)
pkgs/profpatsch: add binify helper
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/profpatsch/default.nix16
1 files changed, 15 insertions, 1 deletions
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;