Hello, I’m looking for some advice on allowing a cross-platform package in Nixpkgs with an x86 build-time dependency to build on additional platforms:
I maintain the package for opentxl in Nixpkgs, which requires another tool named turingplus to build. turingplus only supports x86 architectures, since it requires x86 assembly source for its build process. However, opentxl only uses the turingplus binary for a C code generation step, and then the actual output binary is produced by compiling that generated C code. The emitted code is completely platform-independent, so opentxl should be able to build and run for essentially any system with a C compiler. Doing the codegen on one platform and then building the generated source on another is also the recommended approach upstream for building on systems that turingplus doesn’t support.
The issue is that I don’t know whether there’s a good way to specify this dependency in such a way that opentxl could build on, for example, aarch64-linux and aarch64-darwin, in spite of the turingplus dependency not running on those systems. One thing I was thinking was that the codegen step could be moved into its own derivation, and then a system that can’t run turingplus might be able to fetch that derivation from the cache once a system that can run it finishes building?
Would there be any way to accomplish that with Nixpkgs (or some other solution that could allow it to build on non-x86)?