git.iko.soy/typeable/nixpkgs
on master help sign in
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)

commit74d446176e66d6250ce977011d49a8dd72d6b114 authorAaron Andersen <aaron@fosslib.net> dateFri 17 Aug 2018, 14:16 (8 years ago) parentd5003f5
3 files changed+17−9
lib/default.nix+1−1 lib/strings.nix+16 pkgs/top-level/perl-packages.nix−8
lib/default.nix+1−1
@@ -80,7 +80,7 @@ let
8080 inherit (strings) concatStrings concatMapStrings concatImapStrings
8181 intersperse concatStringsSep concatMapStringsSep
8282 concatImapStringsSep makeSearchPath makeSearchPathOutput
83− makeLibraryPath makeBinPath makePerlPath optionalString
83+ makeLibraryPath makeBinPath makePerlPath makeFullPerlPath optionalString
8484 hasPrefix hasSuffix stringToCharacters stringAsChars escape
8585 escapeShellArg escapeShellArgs replaceChars lowerChars
8686 upperChars toLower toUpper addContextFrom splitString
lib/strings.nix+16
@@ -126,6 +126,22 @@ rec {
126126 */
127127 makePerlPath = makeSearchPathOutput "lib" "lib/perl5/site_perl";
128128
129+ /* Construct a perl search path recursively including all dependencies (such as $PERL5LIB)
130+
131+ Example:
132+ pkgs = import <nixpkgs> { }
133+ makeFullPerlPath [ pkgs.perlPackages.CGI ]
134+ => "/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"
135+ */
136+ makeFullPerlPath = deps:
137+ let
138+ recurse = dep:
139+ [ dep ] ++ dep.propagatedBuildInputs ++ (map (arg: recurse arg) dep.propagatedBuildInputs)
140+ ;
141+ in
142+ makePerlPath (lib.unique (lib.flatten (map (arg: recurse arg) deps)))
143+ ;
144+
129145 /* Depending on the boolean `cond', return either the given string
130146 or the empty string. Useful to concatenate against a bigger string.
131147
pkgs/top-level/perl-packages.nix−8
@@ -28,14 +28,6 @@ let
2828 checkPhase = "./Build test";
2929 });
3030
31− # Helper function to make a PERL5LIB environment variable for a list of perlPackages and all associated runtime dependencies
32− makePerl5Lib = deps:
33− with stdenv;
34− lib.concatStringsSep ":" [
35− (lib.makePerlPath deps)
36− (lib.concatStringsSep ":" (map (dep: dep + "/lib/perl5/site_perl") (builtins.filter (dep: dep != null) (lib.flatten (map (dep: lib.getOutput "propagatedBuildInputs" dep) deps)))))
37− ]
38− ;
3931
4032 ack = buildPerlPackage rec {
4133 name = "ack-2.24";