[Nix-dev] Setting an environment variable in "extraCmds"

Mateusz Kowalczyk fuuzetsu at fuuzetsu.co.uk
Sat May 17 00:34:09 CEST 2014


On 05/16/2014 10:44 PM, Alfredo Di Napoli wrote:
> Hello everyone,
> 
> I have just recently started using Nix and I find it quite cool. Something
> I'm trying to do is to sandbox an Haskell GHC version to bootstrap, via
> nix-shell, a completely isolated environment. This is what I have achieved
> so far:
> 
> https://gist.github.com/adinapoli/7bce04c56325d5bd9c47
> 
> Now, if I type:
> 
> nix-shell --pure
> 
> it does work, but if I type
> 
> echo $PATH
> 
> my PATH won't contain what I have just specified in extraCmds.
> Any idea of what I'm doing wrong?
> 
> Thanks in advance!
> Alfredo
> 
> 
> 
> _______________________________________________
> nix-dev mailing list
> nix-dev at lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
> 

I'm unsure why you're using extraCmds at all here. Why is it necessary
to use the stuff from your ~/.cabal ?

For reference, I just did something like this recently. See [1] for a
default.nix in which I can build GHC. I can not vouch for running
validate (for example, nix-shell resets LANG to ‘C’ which screws up the
tests) but it should work for building. Make sure to fix up the paths in
it, I use absolute ones so I can ln -s to it without troubles.

It does not use myEnvFun however, I have not looked into that kind of
setup yet. I think John Wiegley has a setup you might want to look at too.

[1]:
https://github.com/Fuuzetsu/nix-project-defaults/blob/master/ghc/default.nix

-- 
Mateusz K.


More information about the nix-dev mailing list