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

Lluís Batlle i Rossell viric at viric.name
Sat Mar 3 20:27:20 CET 2012


On Sat, Mar 03, 2012 at 09:51:46AM -0800, Corey O'Connor wrote:
> That was exactly what I needed! Thanks!
> 
> I did not know something basic: How to add the the dev-env to the user
> profile. The process I found that worked was to run
> 
> $ nix-env -iA nixpkgs_sys.config.webEnv

No no. You need the webEnv in packageOverrides, better. Then "nix-env -qa" will see
it.

in config.nix:
{pkgs}:
{
    packageOverrides = pkgs: {
        webEnv = blabla;
    };
}

> Which then add a .nix-profile/dev-env directory.
> I am not sure if there is just a "rebuild .nix-profile" command.
> nixos-rebuild appears to only rebuild the system profile.

the nix profile is defined through '-i' and '-e' operations, which end up
defining ~/.nix-profile/manifest.nix. That has a list of fixed store paths, so
rebuilding that means nothing.

You can use "nix-env -u \*" too, that may be close to what you mean by rebuild.

> Two notes:
> 0. I find it odd that nixpkgs_sys is required. Is it really a system
> package at this point?

That comes from ~/.nix-defexpr, which is what nix-env uses to locate
nix expressions (when not giving them with -f).

> 1. There is no load-[name]-env script exposed that I can find. Is that
> something I also need to expose via .nixpkgs/config.nix?

I think a recent nixpkgs had that. I never used it (still), becasue I had my own loading
script before that change.

Regards,
Lluís.

> On Sat, Mar 3, 2012 at 7:07 AM, Mathijs Kwik <mathijs at bluescreen303.nl> wrote:
> > I use myEnvFun for that in my ~/.nixpkgs/config.nix:
> >
> > webEnv = pkgs.myEnvFun {
> >  name = "webdev";
> >  buildInputs = [pkgs.stdenv pkgs.jruby165 pkgs.nodejs];
> > };
> >
> > As you can see, I include stdenv there as well.
> > You are correct that auto* is in stdenv, but you normally don't have
> > the standard build environment loaded in your system/home profile.
> >
> > A myEnvFun gives you custom environments setup files under
> > ~/.nix-profile/dev-envs, which contain environment variables and
> > paths.
> > You can source this file (I believe Arie Middelkoop also automatically
> > added a shell script "load-[name]-env" that does this for you.
> > Then every time you want to work on your project, you load that env
> > and find all stdenv (and other packages you include) available to you.
> >
> >
> >
> > On Sat, Mar 3, 2012 at 8:27 AM, Corey O'Connor <coreyoconnor at gmail.com> wrote:
> >> Hi All,
> >>
> >> 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.
> >>
> >> Am I missing something?
> >>
> >> -Corey O'Connor
> >> coreyoconnor at gmail.com
> >> http://corebotllc.com/
> >> _______________________________________________
> >> 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