From ae607de23dbb441b2bc3c1a967d158fbf68c3f80 Mon Sep 17 00:00:00 2001 From: "(cdep)illabout" Date: Tue, 1 Oct 2019 15:40:47 +0900 Subject: [PATCH] linkFarmFromDrvs: Add a trivial builder to create a linkFarm from a list of derivations --- pkgs/build-support/trivial-builders.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/build-support/trivial-builders.nix b/pkgs/build-support/trivial-builders.nix index e107db2db5c..f2e6f7d38d5 100644 --- a/pkgs/build-support/trivial-builders.nix +++ b/pkgs/build-support/trivial-builders.nix @@ -335,6 +335,21 @@ rec { '') entries} ''; + /* + * Easily create a linkFarm from a set of derivations. + * + * This calls linkFarm with a list of entries created from the list of input + * derivations. It turns each input derivation into an attribute set + * like { name = drv.name ; path = drv }, and passes this to linkFarm. + * + * Example: + * + * # Symlinks the hello, gcc, and ghc derivations in $out + * linkFarmFromDrvs "example" [ pkgs.hello pkgs.gcc pkgs.ghc ] + */ + linkFarmFromDrvs = name: drvs: + let mkEntryFromDrv = drv: { name = drv.name; path = drv; }; + in linkFarm name (map mkEntryFromDrv drvs); /* Print an error message if the file with the specified name and * hash doesn't exist in the Nix store. This function should only