I have a custom installation of nix in a non standard directory, long story short I configured the installation as so:
./configure \ --enable-gc \ --with-store-dir="/cvmfs/packages.redbeardlab.com/nix/store" \ --localstatedir="/cvmfs/packages.redbeardlab.com/nix/state"
After that I compiled and installed nix with make, and everything went fine.
Them, I added the stable channel using
nix-channel --add $THE_URL and then I tried to install something.
nix-env -i gcc
It get stuck with an error like:
/build/$somethign is not a directory.
The solution to the problem was to create the directory
/build the next problem was indeed not enough permission on
/build (correct, I created the directory as root, while I am building as user
ubuntu). I change the ownership of the directory to
ubuntu and now it is happily compiling.
I believe the problem is that the environment variable
NIX_BUILD_TOP is empty during the build process. I tried to lookup into the code, but that variable seems to be set in a quite straightforward way.
How can I fix the problem? I would like nix to build somewhere else than the directory
/build I create for it.