Cross compile nixos sd image for Rasberry pi 2

I’m trying to cross comp nixos for my rasberry 2.
I’m using this flake:

        rpi2 = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [
            "${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix"
            {
              nixpkgs.config.allowUnsupportedSystem = true;
              nixpkgs.crossSystem.system = "armv7l-linux";

              users.users = {
                root.openssh.authorizedKeys.keys = [
                  "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDIc5ug7o0Jqe6SNNrjW5BAyTWqZGVvehJ7GOZrT7DFiiop174CdDlRo4GZlvAGzFEaWr5/4knS0p8kErDPgcgdfC0IL2BYClPEna8agHhyqvmZISxfFDk48Bg/yGo37iPpuGxT7g6VIqI46PnTqgF3nfX1J3crPDD1tDUv5Nq+LH3qlwnpRA3rMBTym/QPkPAM8jQGB4DtyhI1s6UBEQK5vvljhYBG/P54ILQUokYqIsUirQKpBW7Z3sY+zezJpOc+Y6DRZ0rm9dRa6HsOFQ1DQ6u3FkBcyq+vkr4KWmxDdRO0acAV6o0c+1dqyhdaKfklO1E9ZOScTG9Wur9p17qMPsd1zJ8OZ5S7NDMMFi2wcUkxQO9QNqndo+opOBYVMxrz2Hc2Ch2vzuSlVwUxKE60qfARFZ5ZbVOJ8Ate+vghrldgyRF7Sg5yid8Rv6RHv4nvJZpEFjmtkluWzNwhoaF9ifNdB2y7MZeDgu1n1v9xmexSYs97cCB+sprSLYrqgsk= florian@nixos-thinkpad"
                  "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCg3kPf2YxtGrfckExx/ckZrsXH1sa0mDGAAVaK6VOpLF4s0fnWJmXrBSfeGgOVPHRCNF3dfQR34u5PwO3gtK8FQr8XvVRKP+EcMi3ztKHcawnThJyB2Zi3D8yTGDYnKRXoiDvitTWtDDmZta91QJZsK65R0SeOGSk1lG6MOYyEhTRQS4rV1Ij8qEqAMB7R7/yUIkdoyGDbcDZ05Bs8/NCfBLJ/pv+pRKp+ZFIjqmKNVYznZ4OT7ywbbQaTNUCoQO4Hcm+ujlOw2jV7Xqb9842uBRQKNKik3hGw1DlAxKrbK/s3Uu0Vs/cUrEoH68+tKZdCzoX3YoYI9cyMRS2+LEkb florian@florian"
                  "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDJjjBxd9De7YH9ZCzSLmmBTXYmMOdPaLuToZc5zFe/FUz8V8NhQCmHnPP/wcL2/3gz8jz19PcXKN4jc204Nx+XrFvXPO2BMuaeztwyhLd7o5LLmWEm66PImXq4BPLUH/QTlSumIDPwnehUnorUVEcso2VSBidZ4hor2FTIvP3x3DT19xw+cH19fh6xjSEx3bYk8aQTbXpxQAduou8Q424fmOuaQcCO9f3odYmuhVhmN6hjtCK/NhcKQRQ25C1Ftw+NcC++e2c196J4VLTB3XybKU4BYPI9A1Lq8QHNS16JapGWcvoaamx5o8Br+zxmmBlTJvhMSEUga02QXMrVPkTaDDAwtzSBl1mSD9lx5haCySCH9vsjfR5aoc5Axm1qPiO+kxlLSCmdd7CxexWPR0WbmCt7toPHXGoeVHxY2p6AdeZDdgdr1ccf2iLcE7Y37cwvEBiQx0KCAN3kkYAdSBxFStUDUMtb+cbrnDAqCztg5LIr4GoT5PeXtPW2CCUl74c= root@nixos-thinkpad"
                ];
              };
            }
          ];
        };
      };

      images.rpi2 = self.nixosConfigurations.rpi2.config.system.build.sdImage;

When I try to build this i get the error:

@nix { "action": "setPhase", "phase": "unpackPhase" }
unpacking sources
unpacking source archive /nix/store/dbrympqgvc8lyjs3572apxxngdh6jy4j-File-ShareDir-1.118.tar.gz
source root is File-ShareDir-1.118
setting SOURCE_DATE_EPOCH to timestamp 1603260759 of file File-ShareDir-1.118/META.yml
@nix { "action": "setPhase", "phase": "patchPhase" }
patching sources
@nix { "action": "setPhase", "phase": "updateAutotoolsGnuConfigScriptsPhase" }
updateAutotoolsGnuConfigScriptsPhase
@nix { "action": "setPhase", "phase": "configurePhase" }
configuring
patching ./t/01_compile.t...
patching ./t/06_old.t...
patching ./t/02_main.t...
patching ./t/05_class.t...
patching ./t/04_fail.t...
patching ./t/00_prereqs.t...
patching ./Makefile.PL...
Can't load module IO, dynamic loading not available in this perl.
  (You may need to build a new perl executable which either supports
  dynamic loading or has the IO module statically linked into it.)
 at /nix/store/jb9937r1dzpkjh543y45mhdknhl89sci-perl-armv7l-unknown-linux-gnueabihf-5.34.1/lib/perl5/5.34.1/armv7l-linux/IO/Handle.pm line 268.
Compilation failed in require at /nix/store/jb9937r1dzpkjh543y45mhdknhl89sci-perl-armv7l-unknown-linux-gnueabihf-5.34.1/lib/perl5/5.34.1/armv7l-linux/IO/Handle.pm line 268.
BEGIN failed--compilation aborted at /nix/store/jb9937r1dzpkjh543y45mhdknhl89sci-perl-armv7l-unknown-linux-gnueabihf-5.34.1/lib/perl5/5.34.1/armv7l-linux/IO/Handle.pm line 268.
Compilation failed in require at /nix/store/jb9937r1dzpkjh543y45mhdknhl89sci-perl-armv7l-unknown-linux-gnueabihf-5.34.1/lib/perl5/5.34.1/armv7l-linux/IO/Seekable.pm line 100.
BEGIN failed--compilation aborted at /nix/store/jb9937r1dzpkjh543y45mhdknhl89sci-perl-armv7l-unknown-linux-gnueabihf-5.34.1/lib/perl5/5.34.1/armv7l-linux/IO/Seekable.pm line 100.
Compilation failed in require at /nix/store/jb9937r1dzpkjh543y45mhdknhl89sci-perl-armv7l-unknown-linux-gnueabihf-5.34.1/lib/perl5/5.34.1/armv7l-linux/IO/File.pm line 132.
BEGIN failed--compilation aborted at /nix/store/jb9937r1dzpkjh543y45mhdknhl89sci-perl-armv7l-unknown-linux-gnueabihf-5.34.1/lib/perl5/5.34.1/armv7l-linux/IO/File.pm line 132.
Compilation failed in require at inc/latest/private.pm line 10.
BEGIN failed--compilation aborted at inc/latest/private.pm line 10.
Compilation failed in require at inc/latest.pm line 5.
Compilation failed in require at Makefile.PL line 18.
BEGIN failed--compilation aborted at Makefile.PL line 18.

Has someone managed to build nixos image for pi 2

This seems to be related to https://github.com/NixOS/nixpkgs/issues/142122

Not at my PC now, but I expect that there should be a working channel. What nixpkgs revision are you using?

I am using this https://github.com/NixOS/nixpkgs/tree/9370544d849be8a07193e7611d02e6f6f1b10768 revision