From 2a3b3d6f8b75eb10ab638d32c163bc6ca798ae50 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Wed, 13 Apr 2016 15:33:21 +0300 Subject: [PATCH] makeSearchPathOutputs: init function --- lib/strings.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/strings.nix b/lib/strings.nix index 6818e589bc1c..30c24f7bde5a 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -88,6 +88,16 @@ rec { makeSearchPath = subDir: packages: concatStringsSep ":" (map (path: path + "/" + subDir) packages); + /* Construct a Unix-style search path, given trying outputs in order. + If no output is found, fallback to `.out` and then to the default. + + Example: + makeSearchPathOutputs "bin" ["bin"] [ pkgs.openssl pkgs.zlib ] + => "/nix/store/9rz8gxhzf8sw4kf2j2f1grr49w8zx5vj-openssl-1.0.1r-bin/bin:/nix/store/wwh7mhwh269sfjkm6k5665b5kgp7jrk2-zlib-1.2.8/bin" + */ + makeSearchPathOutputs = subDir: outputs: pkgs: + makeSearchPath subDir (map (lib.tryAttrs (outputs ++ ["out"])) pkgs); + /* Construct a library search path (such as RPATH) containing the libraries for a set of packages