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

Mathijs Kwik mathijs at bluescreen303.nl
Sun Jan 22 12:58:39 CET 2012


Ah, very nice.
I didn't know about my-env.
This will work, thanks


2012/1/22 Lluís Batlle i Rossell <viric at viric.name>:
> On Sun, Jan 22, 2012 at 12:46:23PM +0100, Mathijs Kwik wrote:
>> 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.
>>
>
> I use 'myEnv', like this in packageOverrides:
>      offrssEnv = pkgs.myEnvFun {
>          name = "offrss";
>          stdenv = ccacheStdenv;
>          buildInputs = [ libmrss curl podofo ];
>      };
>
>      fossilEnvClang = pkgs.myEnvFun {
>          name = "fossil-clang";
>          buildInputs = [ clangStdenv zlib readline openssl ];
>      };
>
> ...
>
> I install them: "nix-env -i offrss-env"
> And then I load them using this script I attach, with "loadenv offrss" for
> example.
>
> Regards,
> Lluís.


More information about the nix-dev mailing list