File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ { config , lib , pkgs , ... } :
2+
3+ let
4+ cfg = config . language . perl ;
5+ strOrPackage = import ../../nix/strOrPackage.nix { inherit lib pkgs ; } ;
6+
7+ in
8+ with lib ;
9+ {
10+ options . language . perl = {
11+ extraPackages = mkOption {
12+ type = types . listOf strOrPackage ;
13+ default = [ ] ;
14+ example = literalExpression "[ perl538Packages.FileNext ]" ;
15+ description = "List of extra packages (coming from perl5XXPackages) to add" ;
16+ } ;
17+ libraryPaths = mkOption {
18+ type = types . listOf types . str ;
19+ default = [ ] ;
20+ example = literalExpression "[ ./lib ]" ;
21+ description = "List of paths to add to PERL5LIB" ;
22+ } ;
23+ package = mkOption {
24+ type = strOrPackage ;
25+ default = pkgs . perl ;
26+ example = literalExpression "pkgs.perl538" ;
27+ description = "Which Perl package to use" ;
28+ } ;
29+ } ;
30+
31+ config = {
32+ env = [
33+ ( mkIf ( cfg . extraPackages != [ ] ) {
34+ name = "PERL5LIB" ;
35+ prefix = pkgs . perlPackages . makePerlPath cfg . extraPackages ;
36+ } )
37+ ( mkIf ( cfg . libraryPaths != [ ] ) {
38+ name = "PERL5LIB" ;
39+ prefix = concatStringsSep ":" cfg . libraryPaths ;
40+ } )
41+ ] ;
42+ devshell . packages = [ cfg . package ] ++ cfg . extraPackages ;
43+ } ;
44+ }
Original file line number Diff line number Diff line change 1+ { pkgs , devshell , runTest } :
2+ {
3+ # Basic test
4+ simple =
5+ let
6+ shell = devshell . mkShell {
7+ imports = [ ../../extra/language/perl.nix ] ;
8+ devshell . name = "language-perl-simple" ;
9+ } ;
10+ in
11+ runTest "simple" { } ''
12+ # Load the devshell
13+ source ${ shell } /env.bash
14+
15+ # Has a Perl interpreter
16+ type -p perl
17+ '' ;
18+ }
You can’t perform that action at this time.
0 commit comments