When packaging software in nixpkgs I often run into situations where the build takes a long time, but I need to do some ad-hoc experimenting during the postInstall. This is quite cumbersome to go through all the phases using nix build for each change I try.
I think that nix develop is the command to use for these cases, but it is unclear to me how I can use it to actually reproduce the steps that nix build is using.
From what I gathered so far I use the following steps:
$ nix develop --ignore-environment .#hello
$ unpackPhase
From here I need to look up what directory unpackPhase actually created. I used ls for that:
$ ls
... different directories from nixpkgs ...
hello-2.12.1
...
$ cd hello-2.12.1
From here it is a bit unclear, as I don’t know for sure what phases an arbitrary package has. $phases doesn’t exist, so I try the usual suspects:
patchPhaseconfigurePhasebuildPhase
This results in an error:
build flags: SHELL=/run/current-system/sw/bin/fish
It was using my systems shell, instead of the one that is needed for the build. I did use --ignore-environment, so I’m not sure why the SHELL variable unintendedly got in there.
I use export SHELL=$(command -v bash) to circumvent this.
For packages that have additional phases I have run into cases where I missed one of them (from top of my mind cargo?).
Seeing this experience being less than ideal, what is the intended way to use nix develop or debug a build in general?