diff --git a/examples/perl/devenv.nix b/examples/perl/devenv.nix new file mode 100644 index 000000000..381b6e346 --- /dev/null +++ b/examples/perl/devenv.nix @@ -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(" ")' + ''; +} diff --git a/examples/perl/devenv.yaml b/examples/perl/devenv.yaml new file mode 100644 index 000000000..c7cb5ceda --- /dev/null +++ b/examples/perl/devenv.yaml @@ -0,0 +1,3 @@ +inputs: + nixpkgs: + url: github:NixOS/nixpkgs/nixpkgs-unstable diff --git a/src/modules/languages/perl.nix b/src/modules/languages/perl.nix index 15b87bef8..6cee3b497 100644 --- a/src/modules/languages/perl.nix +++ b/src/modules/languages/perl.nix @@ -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))) ]; }; }