about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2023-11-09 22:08:19 +0000
committerRobert Scott <code@humanleg.org.uk>2023-12-02 14:47:36 +0000
commit035d1e2cf9ce2e673db853ec6a8ac6161124189a (patch)
tree3d236bd3e1639731302ea372fe3509a6bc8a0cc1 /pkgs/build-support
parente7704a1b645c94d51fdfdb2875638d3ffae0f15b (diff)
trivial-builders: add onlyBin
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/trivial-builders/default.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix
index 744c7807f4634..0b9f696d1cb80 100644
--- a/pkgs/build-support/trivial-builders/default.nix
+++ b/pkgs/build-support/trivial-builders/default.nix
@@ -631,6 +631,19 @@ rec {
     let mkEntryFromDrv = drv: { name = drv.name; path = drv; };
     in linkFarm name (map mkEntryFromDrv drvs);
 
+  /*
+    Produce a derivation that links to the target derivation's `/bin`,
+    and *only* `/bin`.
+
+    This is useful when your favourite package doesn't have a separate
+    bin output and other contents of the package's output (e.g. setup
+    hooks) cause trouble when used in your environment.
+  */
+  onlyBin = drv: runCommand "${drv.name}-only-bin" {} ''
+    mkdir -p $out
+    ln -s ${lib.getBin drv}/bin $out/bin
+  '';
+
 
   # docs in doc/builders/special/makesetuphook.section.md
   makeSetupHook =