Skip to content

Commit

Permalink
Merge pull request #832 from marcusramberg/marcus/perl-packages
Browse files Browse the repository at this point in the history
perl: Add support for packages attribute.
  • Loading branch information
domenkozar authored Oct 3, 2023
2 parents 42a26aa + e75b686 commit 90c648c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
9 changes: 9 additions & 0 deletions examples/perl/devenv.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
_:

{
languages.perl.enable = true;
languages.perl.packages = [ "Mojolicious" "Text::Markdown::Hoedown" ];
enterShell = ''
perl -MText::Markdown::Hoedown -Mojo -e 'say c(1,2,markdown("hey"))->join(" ")'
'';
}
3 changes: 3 additions & 0 deletions examples/perl/devenv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
inputs:
nixpkgs:
url: github:NixOS/nixpkgs/nixpkgs-unstable
11 changes: 10 additions & 1 deletion src/modules/languages/perl.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ in
{
options.languages.perl = {
enable = lib.mkEnableOption "tools for Perl development";
packages = lib.mkOption
{
type = lib.types.listOf lib.types.str;
description = "Perl packages to include";
default = [ ];
example = [ "Mojolicious" ];
};
};

config = lib.mkIf cfg.enable {
packages = with pkgs; [
perl
(perl.withPackages (p: (with builtins; map
(pkg: p.${ replaceStrings [ "::" ] [ "" ] pkg })
cfg.packages)))
];
};
}

0 comments on commit 90c648c

Please sign in to comment.