linkFarmFromDrvs: Add a trivial builder to create a linkFarm from a list of derivations

This commit is contained in:
(cdep)illabout 2019-10-01 15:40:47 +09:00 committed by Profpatsch
parent c2b6b6d97e
commit ae607de23d

View File

@ -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