Derivation from standard automake with Perl module install

I’m trying to create a derivation for gnupod. It uses automake, which made the process very easy. The problem is that during the install phase, the installer attempts to install perl modules at $perlbin, which is write-protected during nix-build.

My derivation looks like:

  pkgs ? import (fetchTarball "") {

pkgs.stdenv.mkDerivation rec {
  version = "0.99.8";
  pname = "gnupod";

  src = fetchGit {
    url = "git://";

  nativeBuildInputs = [

  buildInputs = [
  ] ++ (with pkgs.perlPackages; [

The error thrown is:

_recmkdir(//nix/store/wmpankr1aiwv9qd2533fav779yrcicry-perl-5.32.1/lib/perl5/site_perl/5.32.1/x86_64-linux-thread-multi/GNUpod): Failed to create //nix/store/wmpankr1aiwv9qd2533fav779yrcicry-perl-5.32.1/lib/perl5/site_perl/5.32.1/x86_64-linux-thread-multi/GNUpod/: Permission denied
make: *** [Makefile:28: install] Error 13
builder for '/nix/store/hjkx2fl7ik8h7ipk4if5qq34hbkj1ss9-gnupod-0.99.8.drv' failed with exit code 2

The offending line in the install script (./tools/ is this:

     print "Installing GNUpod $VINSTALL using gnupod_install 0.26\n";
     install_scripts("build/bin/*.pl", $DST.$opts{bindir});
 --> install_pm("build/bin/GNUpod", "GNUpod", $opts{perlbin}, $DST);
     install_man("build/man/*.gz", $DST.$opts{mandir}."/man1");
     install_info("build/info/", $DST.$opts{infodir});

in which the script attempts to copy every .pm file into the perl directory.

There must must an override builtin to Nix, or a flag to automake that I’m missing, but I’ve spent hours looking through examples and source code. Any help would be appreciated!

After working through this for a few days, I think I can rephrase my question (and still can’t find the answer):

GNUpod is attempting to add custom Perl modules (.pm files) to the PERLBIN path, which I assume is standard practice in Perl. In NixOS, do I need to create separate derivations for these custom .pm files in order to include them in the GNUpod derivation? (That seems silly… they’re custom code for this specific program.) Or is there a way to package custom Perl modules in a derivation so that they’re available to the program when it runs and can still be called with use GNUPod::XMLHelper;?