forked from numtide/devshell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathperl.nix
More file actions
47 lines (45 loc) · 1.19 KB
/
perl.nix
File metadata and controls
47 lines (45 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
config,
lib,
pkgs,
...
}:
let
cfg = config.language.perl;
strOrPackage = import ../../nix/strOrPackage.nix { inherit lib pkgs; };
in
{
options.language.perl = with lib; {
extraPackages = mkOption {
type = types.listOf strOrPackage;
default = [ ];
example = literalExpression "[ perl538Packages.FileNext ]";
description = "List of extra packages (coming from perl5XXPackages) to add";
};
libraryPaths = mkOption {
type = types.listOf types.str;
default = [ ];
example = literalExpression "[ ./lib ]";
description = "List of paths to add to PERL5LIB";
};
package = mkOption {
type = strOrPackage;
default = pkgs.perl;
example = literalExpression "pkgs.perl538";
description = "Which Perl package to use";
};
};
config = {
env = [
(lib.mkIf (cfg.extraPackages != [ ]) {
name = "PERL5LIB";
prefix = pkgs.perlPackages.makeFullPerlPath cfg.extraPackages;
})
(lib.mkIf (cfg.libraryPaths != [ ]) {
name = "PERL5LIB";
prefix = lib.concatStringsSep ":" cfg.libraryPaths;
})
];
devshell.packages = [ cfg.package ] ++ cfg.extraPackages;
};
}