I have a flake.nix in my project with various dependencies, some of which are custom. I usually develop my code by typing nix develop ... and then building my code from there.
One of my custom dependencies has an issue. It’s not that the build is failing. It builds successfully. But it builds the wrong features, somehow, despite nix log clearly showing that the right flags are being passed to the dependency’s cmake command line.
Since the build log doesn’t show enough information to debug the issue, I need to see the actual build tree for the dependency to figure out what’s going wrong (e.g., look at the dependency’s CMakeCaches.txt). However, because the build doesn’t fail outright, Nix seems to remove the dependency before I get a chance to inspect it, even when I pass --keep-outputs to nix develop. I can’t find a flag that keeps the build tree around, and everything I find on Google search is about failed builds, which mine is not.
The only thing I can figure right now is to manually make a version of the dependency that intentionally fails the build so that I inspect its output, which would make iterating on my debugging process incredibly slow. If the issue isn’t immediately obvious it’ll take forever to find it.
Surely there has to be a way to get Nix to keep the build output for successful builds?
Thanks in advance.
P.S. Manually replicating the build flags for this dependency outside of Nix does not replicate the problem. So the problem is somehow specific to Nix’s build environment, which is why I have to replicate this inside of Nix in order to debug it.