Cross-Compiling for Custom Embedded Devices Using Nixpkgs

I work with custom embedded devices provided by customers, which typically include a root filesystem, cross-compilation toolchain, Yocto layers, and sometimes Buildroot. While I am able to cross-compile binaries, it can be tedious to compile up-to-date tools for debugging the system.

Recently, I stumbled upon Nixpkgs, which seems to simplify the process of cross-compiling specific versions of binaries. My initial tests using ARMv7 worked flawlessly. However, I encountered issues when trying to build for MIPS1 using the following code:

with import <nixpkgs> {
  crossSystem = {
    config = "mipsel-unknown-linux-gnu";
    bigEndian = false;
    arch = "mipsel";
    float = "soft";
    libc = "uclibc";
  };
};

mkShell {
  buildInputs = [ pkgsStatic.gdb ];
  postBuild = ''
    mkdir -p $out/bin
    cp ${gdb}/* $out/
  '';
}

While the build was successful, it generated a MIPS32 binary instead of a MIPS1 binary. Additionally, I was unable to copy the binary from the Nix store to a local folder.

I have two questions:

  1. Can I use an external toolchain, such as the one provided by the customer?
  2. Is this the correct approach to accomplish cross-compilation for MIPS1?

I have found multiple articles about cross-compilation but am unsure of the best practices. Any guidance or suggestions would be greatly appreciated.

Thank you!