[Nix-dev] nix-shell ignores custom configurePhase/buildPhase etc.?
Bjørn Forsman
bjorn.forsman at gmail.com
Mon Sep 16 20:09:58 CEST 2013
On 16 September 2013 13:26, Eelco Dolstra <eelco.dolstra at logicblox.com> wrote:
> Hi,
>
> On 15/09/13 14:30, Bjørn Forsman wrote:
>
>> Why doesn't a custom configurePhase (or buildPhase, installPhase etc.)
>> work when run from nix-shell? In nix-shell, all phases seem to be the
>> default, even if the derivation has customized some of them.
>
> That's because you're defining configurePhase as an environment variable, so you
> need to run it as "$configurePhase" instead of "configurePhase".
>
> FYI, stdenv's setup.sh runs a phase as follows:
>
> eval "${!curPhase:-$curPhase}"
>
> I.e. it evaluates the contents of the environment variable named after the phase
> if defined, and otherwise the function named after the phase.
Thanks!
I was going to say "we must update the wiki[1]", but then I got an idea.
Why don't we make those default functions in stdenv figure out whether
to call the custom configure/build/installPhase snippets themselves?
Because as of now, "single stepping" through a build, and ensuring
custom phases are used, is a bit cumbersome:
curPhase=unpackPhase
eval "${!curPhase:-$curPhase}"
curPhase=configurePhase
eval "${!curPhase:-$curPhase}"
[...]
[1] https://nixos.org/wiki/Create_and_debug_nix_packages
Best regards,
Bjørn Forsman
More information about the nix-dev
mailing list