Perl: Difference between revisions

imported>StefanSchroeder
m Fix broken link to blog.
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 59: Line 59:
# After reviewing the result from the previous step and making appropriate modifications, add it to <code>pkgs/top-level/perl-packages.nix</code>.  Note that some things use <code>buildPerlPackage</code> while some use <code>buildPerlModule</code>.  Also note the mostly-followed naming convention as well as the mostly-followed alphabetical ordering. There are plenty of examples in <tt>perl-packages.nix</tt> &mdash; use the source, Luke!
# After reviewing the result from the previous step and making appropriate modifications, add it to <code>pkgs/top-level/perl-packages.nix</code>.  Note that some things use <code>buildPerlPackage</code> while some use <code>buildPerlModule</code>.  Also note the mostly-followed naming convention as well as the mostly-followed alphabetical ordering. There are plenty of examples in <tt>perl-packages.nix</tt> &mdash; use the source, Luke!
# Build and test.
# Build and test.
==Adding something without a Makefile.PL==
The perlPackages.buildPerlPackage assumes a Makefile.PL to exist as part of the configurePhase.
If no such file is present in the project you are building, it is easiest to add a Makefile.PL into the source yourself.
The example below does so by adding it using the postPatch hook:
<syntaxHighlight lang="nix">
postPatch = ''
  cat <<EOF > Makefile.PL
    use v5.10;
    use ExtUtils::MakeMaker;
    WriteMakefile(
        NAME          => 'RevBank',
        VERSION_FROM  => 'revbank',
        ABSTRACT_FROM => 'lib/RevBank.pod',
        EXE_FILES    => [ 'revbank' ],
    );
  EOF
'';
</syntaxhighlight>
The documentation for ExtUtils::MakeMaker can be found [https://perldoc.perl.org/ExtUtils::MakeMaker here].


==Wrappers for installed programs==
==Wrappers for installed programs==
Line 72: Line 95:
Also keep in mind that <code>makePerlPath</code> would not resolve transitive dependencies of Perl packages. Hence if you want to just reference top-level packages, then use <code>makeFullPerlPath</code> which would recursively resolve dependency graph for you.
Also keep in mind that <code>makePerlPath</code> would not resolve transitive dependencies of Perl packages. Hence if you want to just reference top-level packages, then use <code>makeFullPerlPath</code> which would recursively resolve dependency graph for you.
== See also ==
== See also ==
* [https://ryantm.github.io/nixpkgs/languages-frameworks/perl/ Nixpkgs Manual - Perl section]
* [https://nixos.org/manual/nixpkgs/stable/#sec-language-perl Nixpkgs Manual - Perl section]
* [https://blog.stigok.com/2020/04/16/building-a-custom-perl-package-for-nixos.html Overriding an existing Perl package in NixOS]
* [https://blog.stigok.com/2020/04/16/building-a-custom-perl-package-for-nixos.html Overriding an existing Perl package in NixOS]
[[Category:Languages]]
[[Category:Languages]]
[[Category:Perl]]