Help cross-compiling Nix binary tarball

Hi folks! I recently bought an Odroid HC2 single-board computer, which has an armv7l architecture. I want to use Nix inside it, but I’m having problems cross-compiling the Nix installer.

My idea was to build a binary tarball and follow the steps detailed in Introduction to install it. However, I’m not able to build that tarball in my x86_64 machine.

I was able to cross compile nix itself from the nixpkgs repo by running:

nix-build default.nix --arg crossSystem ‘(import <nixpkgs/lib>).systems.examples.armv7l-hf-multiplatform’ -A nix

but this just builds the armv7l nix binaries, not the binary tarball with the install script.

To build the binary tarball for x86_64, I had to clone the Nix repo and run the following:

nix-build release.nix -A binaryTarball --arg systems ‘[“x86_64-linux”]’

So I changed the release.nix file to support cross-compilation. The changes I made are detailed in this commit: The problem I’m having is that when I build it I get this error:

error: a ‘armv7l-linux’ with features {} is required to build ‘/nix/store/wlmx3k9zdqc57r3w7wc3nd65zdc5x2ry-bootstrap-tools.drv’, but I am a ‘x86_64-linux’ with features {benchmark, big-parallel, kvm, nixos-test}

that seems to indicate that cross-compilation is not supported.

I would like some help cross-compiling this binary tarball. Since I’ve already built the Nix binaries, I think building the tarball shouldn’t be any harder. But I’m really lost now :cry:

Note: the wiki page at Nix on ARM - NixOS Wiki hasn’t been very useful to me, it seems to be outdated and I’m not sure whether it supports cross-compilation.

Note: I’m aware that there is an armv7l binary cache at that probably has the armv7l Nix binary tarballs already built. However, I would prefer not having to trust an unofficial binary cache.