I am trying to use my machine with a regular setup (store at /nix/store
) to build a package targeting another machine with its store at /other/nix/store
.
I imagine it would be enough to make a copy of the closure and then replace all references (which will probably be only in interpreter and runpath?) to /nix/store
with /other/nix/store
in it, but this doesn’t sound like a particularly robust approach.
So I created a store in the other location on my system and I am now building the package with NIX_STORE_DIR=/other/nix/store
. This will probably work, but the problem I see here is that it rebuilds everything, which is absolutely unnecessary: I don’t need a compiler linked against /other/nix/store
, the usual one would work as well.
I guess one way to put this would be to say, in cross-compiling terms, that I want to use /nix/store
on the build system, while using /other/nix/store
on the host system (and again /nix/store
on the target system, but that does not really matter right now).