[Nix-dev] setting environment values.

Thomas Hunger tehunger at gmail.com
Wed Jan 28 10:18:29 CET 2015


Hi,

There is makeWrapper [1] which wraps your binary in a shell script that
sets some variables before execution. See e.g. [2] for how apache maven
uses it to set JAVA_HOME.

Is that what you are looking for?

~


[1]
https://nixos.org/wiki/Nix_Runtime_Environment_Wrapper

[2]
https://github.com/NixOS/nixpkgs/blob/72e76a18c122ec657fd6825764be79db8d73b3ce/pkgs/development/tools/build-managers/apache-maven/builder.sh#L8

On 27 January 2015 at 18:48, Tim Sears <tim at timsears.com> wrote:

> I am writing a nix expression to port some libraries from another distro.
>
> The libraries have slightly non-standard locations so I would typically
> add some line to my .bashrc file like
>
> export SOMEVAR="somestring"
> export SOMEPATH=/opt/path/to/libs
> export LD_LIBRARY_PATH=$SOMEPATH:$LD_LIBRARY_PATH.
>
> What is the nix way of doing this? I can set SOMEVAR="somestring" in the
> derivation expression, and it appears in my environment after executing
> nix-shell, but SOMEPATH should look like $out/path/to/libs and I am not
> sure how/where to set that.
>
> Suggestions appreciated.
> -Tim
>
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20150128/9ac9cd89/attachment.html 


More information about the nix-dev mailing list