[Nix-dev] Nix vs. Modules

Marc Weber marco-oweber at gmx.de
Thu Feb 24 15:49:42 CET 2011


Excerpts from ludo's message of Thu Feb 24 15:29:17 +0100 2011:
> It would be fairly simple to provide a command akin to ‘module load’
> that would set $PATH, etc. to point to a given profile, somewhat like
> ‘nix-store -r’ does.

> Marc's 'myEnv' seems to do something along these lines, [...]

myEnv was meant to be for devs only to provide a quick and dirty way to
get the environment builders provide into a dev cycle (your repo
directory).

And it does that job very well.

I'm not sure that I really understood what you're looking for.
I rewrote all of the bash initialization - I wrote about the branches
recently.

I introduced a function called nix_add_profile_vars for both: bash and
zsh.

So you install a profile let's say int ~/.nix-profile/module1
you can add it to your env by

nix_add_profile_vars ~/.nix-profile/module1

This takes also care about completion etc.

Its reasonable well tested to not break your system.

Moreover it will fix the annoying run bash or zsh and your env (PATH
etc) will be reset bug.

So my user env is constructed by /etc/bash-comomn.sh (which is sourced
by /etc/{profile,bashrc} this way:

export NIX_PROFILES="$HOME/.nix-profile /nix/var/nix/profiles/default /var/run/current-system/sw"

for p in $NIX_PROFILES; do
  nix_add_profile_vars "$p" --suffix
done

I did the same implementation for zsh.

For both Ruby and Haskell I've augmenting env vars only to work with
special versions with great success using additional derivations and
scripts.

So it may happen that reviewing my patch is all you have to do.
I've been using it for about 2 weeks now without any problems.

You need branch nix2/multiple-shell-support (nixos)
and some library patches found in branch nix2/package-udpates (nixpkgs)

source: http://mawercer.de:7000/

Marc Weber



More information about the nix-dev mailing list