From 74d446176e66d6250ce977011d49a8dd72d6b114 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Fri, 17 Aug 2018 14:16:38 -0400 Subject: as requested: - moved function into strings.nix - renamed function from makePerl5Lib - removed duplicates entries in the resulting value - rewrote the function from scratch after learning a few things (much cleaner now) --- lib/strings.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/strings.nix') diff --git a/lib/strings.nix b/lib/strings.nix index 7cd09a109396..64b5e83ff9b4 100644 --- a/lib/strings.nix +++ b/lib/strings.nix @@ -126,6 +126,22 @@ rec { */ makePerlPath = makeSearchPathOutput "lib" "lib/perl5/site_perl"; + /* Construct a perl search path recursively including all dependencies (such as $PERL5LIB) + + Example: + pkgs = import { } + makeFullPerlPath [ pkgs.perlPackages.CGI ] + => "/nix/store/fddivfrdc1xql02h9q500fpnqy12c74n-perl-CGI-4.38/lib/perl5/site_perl:/nix/store/8hsvdalmsxqkjg0c5ifigpf31vc4vsy2-perl-HTML-Parser-3.72/lib/perl5/site_perl:/nix/store/zhc7wh0xl8hz3y3f71nhlw1559iyvzld-perl-HTML-Tagset-3.20/lib/perl5/site_perl" + */ + makeFullPerlPath = deps: + let + recurse = dep: + [ dep ] ++ dep.propagatedBuildInputs ++ (map (arg: recurse arg) dep.propagatedBuildInputs) + ; + in + makePerlPath (lib.unique (lib.flatten (map (arg: recurse arg) deps))) + ; + /* Depending on the boolean `cond', return either the given string or the empty string. Useful to concatenate against a bigger string. -- cgit 1.4.1