[Nix-dev] nix profiles and env vars - proposal
Marc Weber
marco-oweber at gmx.de
Sat Apr 18 13:25:51 CEST 2009
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
More information about the nix-dev
mailing list