feat(nix/binify): add binify
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" }`.
Change-Id: I600bdcd8f143bca2dd8dfbb165a9a5a8d6397622
Reviewed-on: https://cl.tvl.fyi/c/depot/+/624
Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
b6cb20b2d0
commit
17eba437a7
2 changed files with 17 additions and 0 deletions
16
nix/binify/default.nix
Normal file
16
nix/binify/default.nix
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{ pkgs, lib, ... }:
|
||||
|
||||
# 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" }`.
|
||||
{ exe, name }:
|
||||
|
||||
pkgs.runCommandLocal "binify-${name}" {} ''
|
||||
mkdir -p $out/bin
|
||||
ln -sT ${lib.escapeShellArg exe} $out/bin/${lib.escapeShellArg name}
|
||||
''
|
||||
Loading…
Add table
Add a link
Reference in a new issue