[Nix-dev] How do you work on big packages?

Guillaume Maudoux (Layus) layus.on at gmail.com
Mon Mar 27 17:05:44 CEST 2017


On 26/03/17 21:15, Will Dietz wrote:
> Just to add to this, something I haven't seen neatly documented but I
> personally find very helpful (if a bit rough) is to run "genericBuild"
> from within nix-shell, which will run the phases from the
> derivation... and usually fail to install during installPhase.  I
> often start this and then just interrupt it during the build so I can
> poke at the source or config.log or whatever.
and `set -x` before calling genericBuild may or may not help you ^^.
>
> Anyway, it is an easy way to say "just do what nix-build does" for
> unknown derivations.  Doesn't let you re-use the bits and install into
> the nix store, but usually that's much less of an issue--once I have a
> thing working I don't mind rebuilding (in fact, it's /good/ to rebuild
> from scratch before saying "ship it") one final time.
>
> ~Will
>
> PS: nix-shell doesn't set NIX_BUILD_CORES so I often do something like
> 'NIX_BUILD_CORES=8 genericBuild' (or whatever)
>
> On Fri, Mar 17, 2017 at 2:26 PM, Profpatsch <mail at profpatsch.de> wrote:
>> On 17-03-17 06:04pm, Volth wrote:
>>> "nix-shell" would be a super option here if it could handle
>>> "installPhase" (this seems easy to fix) and .nix files less trivial
>>> than "hello.nix" (this seems not easy to fix; for example "nix-shell
>>> '<nixpkgs>' -A linux_4_4" has no "configurePhase", and there are
>>> similar problems with almost every of the big projects; nix-shell
>>> launches "make" when "nix-build" launches "cmake" or vice-versa, etc)
>> That’s a pretty common stumbling block.
>>
>> If someone defines his own `installPhase` for example,
>> the `installPhase` shell function is just the standard
>> stdenv `installPhase`. What you want to call is rather
>> the contents of `$installPhase` (the variable), since
>> that contains the phase you defined in `mkDerivation`.
>>
>> nix-shell
>> $ unpackPhase
>> unpacking …
>> $ configurePhase
>> configuring …
>> $ buildPhase
>>>> $ $installPhase
>> running your installPhase
>>
>>
>> There is not much abstraction. Every nix attribute within
>> `derivation` (and by extension `mkDerivation`) will end up
>> as a bash shell variable in your shell (and your build env).
>>
>> --
>> Proudly written in Mutt with Vim on NixOS.
>> Q: Why is this email five sentences or less?
>> A: http://five.sentenc.es
>> May take up to five days to read your message. If it’s urgent, call me.
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev



More information about the nix-dev mailing list