Trying to summarize the problem, I think we should think on how to make nix care *more* for the user environment.
Nowadays, nix cares only about the $PATH of the user and its .nix-profile, and the rest comes from non-controlled-by-nix elements: the rest of the environment, $PWD, the rest of the system file tree, and the network. Well, through /etc/bashrc, in nixos, we have not only $PATH, but also a prepared $MANPATH, $PERL_PATH, ... For all elements in the $PATH to work, sometimes non-controlled-by-nix elements must fit. For example, be in a directory writeable by the user, have an environment variable set, have a data path available ($HOME/.program/mysettings), ... Should we enable nix (and nixpkgs) control beyond $PATH, to assure usability of all $PATH elements? How much beyond? Only environment variables? Allow arbitrary execution of code at the start of interactive shells? Care of some writeable paths (a task available only to nixos nowadays)? I think the solution proposed by Marc could solve some of the problems I experience in a safer way. Now I set manually in my .bashrc variables pointing to the store, but nix-store doesn't know anything about my .bashrc. It works for me. Yesterday ludo proposed a new buildEnv-like for python, for which I don't know the details. The system proposed by Marc may solve all such problems, but I can't imagine if that can over-manage the environment (if we ever achieve big files to be sourced, and pass many tasks to the scripts setting the environment beyond the .nix-profile link) 2009/4/18 Marc Weber <[email protected]>: > Lluís Batlle has asked about how to add env vars today. > > I've posted a small patch in the past: > http://thread.gmane.org/gmane.linux.distributions.nixos/44 > > I'd vote for this way to implement it: > > Make the builder.pl creating the final profiile execute > nix-support/post-install/* scripts > passing the list of derivations to be installed. > > Then you can add a derivation to your profile providing a post-install > script collecting env vars from $out/nix-support/env writing the result > to $profile/bash-sourceme (or such) > > Example: > > PythonLibA > $out/nix-support/env contents > PYTHONPATH=/nix/store/xxxxxxxxx-PythonLibA/.../site-packages:$PYTHONPATH > > PythonLibB > $out/nix-support/env contents > PYTHONPATH=/nix/store/xxxxxxxxx-PythonLibB/.../site-packages:$PYTHONPATH > > perl lib > $out/nix-support/env contents > PERLIMPORTS=/nix/store/xxxxxxxxx-perl-lib/lib/...:$PYTHONPATH > > So the post install script iterates over those files and creates one > containing > > PYTHONPATH=/nix/store/xxxxxxxxx-PythonLibA/.../site-packages:$PYTHONPATH > PYTHONPATH=/nix/store/xxxxxxxxx-PythonLibB/.../site-packages:$PYTHONPATH > PERLIMPORTS=/nix/store/xxxxxxxxx-perl-lib/lib/...:$PYTHONPATH > > > If you don't install the post install script nohting will change. > > How do you like this? > > Marc Weber > _______________________________________________ > nix-dev mailing list > [email protected] > https://mail.cs.uu.nl/mailman/listinfo/nix-dev >
_______________________________________________ nix-dev mailing list [email protected] https://mail.cs.uu.nl/mailman/listinfo/nix-dev
