[Nix-dev] best process for building from source under development?

Eelco Dolstra eelco.dolstra at logicblox.com
Sun Mar 4 14:55:22 CET 2012


Hi,

On 03/03/12 08:27, Corey O'Connor wrote:

> Suppose I have a source directory for a product under development. I
> would like to setup the same build environment nix-build will use. I
> have tried setting the src attribute to the source directory. However
> this causes the entire product to be rebuilt every time. I also tried
> copying env-vars from a partial build to the development source
> directory then sourcing this before the standard autoreconf,
> ./configure, make process. This progressed farther but died trying to
> locate autoheader which I would presume was in the standard build
> environment.

There is a command "nix-store --print-env" that prints the environment of a
derivation.  So you can do something like:

  eval "$(nix-store --print-env $(nix-instantiate '<nixpkgs>' -A pkg))"
  NIX_BUILD_TOP=/tmp
  source $stdenv/setup

There should be a nix-build option to do this for you, but I haven't gotten
around to implementing it.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/


More information about the nix-dev mailing list