Simulating the installPhase environment

Say you’re trying to package something you don’t quite know how to install properly. What’s your usual method to set a shell up with the environment the build should occur in? I’m thinking a workflow that would make sense is, somehow get up to mkDerivation’s installPhase, with the build inputs somehow set up, and from there navigate the folders and try commands. Is there a way to do this, to, in a sense, simulate the installation environment to figure out the right way to go about it?

1 Like

This is the other main use of nix-shell: when used without -p, it puts you in an environment where you can run unpackPhase (if you aren’t already in a location with the source code), patchPhase (if needed), configurePhase (ditto), buildPhase, etc.

2 Likes

Oh I see! I’ll be delving deeper into the documentation for nix-shell then, thanks a lot for the answer!