[Nix-dev] local, custom environments for development projects

Mathijs Kwik mathijs at bluescreen303.nl
Sun Jan 22 12:46:23 CET 2012


Hi all,

I'm doing some development work on different projects that all have
their own dependencies.
Currently (leftover from before nix), they are just directories in my homedir.
There are some haskell projects, some ruby, few node.js.
All these projects have their own dependencies, usually managed
through a language's package manager (cabal, gem, npm), but
occasionally needing native deps too (linking to c-based library,
depend on binaries available in PATH, like imagemagick).
As a result, my user environment (~/.nix-profile) contains a lot of
stuff I don't really need, like stdenv, or tools only used by 1
project.

I would like to have a way to setup special custom environments per project.
I know for haskell there's hack-nix and there might be tricks for
other languages/package managers as well, but I'm looking for a
generic solution.

I thought of using a separate user per project and just su into that
when starting development, but that's a bit too much.
I would like to just "be" me when developing, being able to call my
opened web browser, use ssh keys, use my shell aliasses and so on.
Chrooting into an environment will probably have similar issues.

Probably I'm just looking for something to add to my path and other
environment variables, a simple shell script to source when starting
development.
I noticed that nix-build creates some 'env-vars' file while it's
building something, which is close to what I need.

What would be the best way to setup something like that?
How do others work with projects in their homedirs?
Any thoughts?

Thanks,
Mathijs


More information about the nix-dev mailing list