Getting started with Nix on ppc64le

This proved to be a tricky problem, but I’ve finally got Nix running on top of Debian ppc64le! The missing step involves a file called .reginfo, which the installer requires to find store paths from an adjacent folder (rather than installed into /nix/store with an active database).

Googling for .reginfo was difficult. First I found references to pkgs/build-support/kernel/paths-from-graph.pl, but I couldn’t get it to work and it appears to be deprecated in favor of pkgs/build-support/closure-info.nix, which I also could not figure out how to invoke. Ultimately, all I had to use was nix-store --dump-db.

From start to finish, here’s what I executed to get this working:

# Get r-burns' ppc64le branch and build cross (this takes a long time)
git clone -b ppc64le --depth 1 https://github.com/r-burns/nixpkgs.git
nix-build './nixpkgs' -A pkgsCross.powernv.nix

# Get a donor copy of the installer
wget https://releases.nixos.org/nix/nix-2.4/nix-2.4-x86_64-linux.tar.xz
tar xf nix-2.4-x86_64-linux.tar.xz

# Keep the cert package
mkdir -p nix-ppc64le-linux/store
cp nix-2.4-x86_64-linux/store/*nss-cacert* nix-ppc64le-linux/store/

# Toss other packages, keep the scripts
rm -rf nix-2.4-x86_64-linux/store
mv nix-2.4-x86_64-linux/* nix-ppc64le-linux/

# Add ppc64le packages
cp -r $(nix-store -qR result) nix-ppc64le-linux/

# Generate a .reginfo for those ppc64le packages
rm nix-ppc64le-linux/.reginfo
nix-store --dump-db $(nix-store -qR result > nix-ppc64le/.reginfo

Then scp to the other machine, extract, and execute install.