Building with prefix does not work as expected

Hi,

I built Nix from source with

./configure --prefix=${FAKEROOT} --with-store-dir=${FAKEROOT}/nix/store

But when I run nix-daemon I get

error: creating directory '/nix': Permission denied

So it seems somewhere the prefix is not taken into account where it should be. Unfortunately I haven’t yet been able to work out where in the daemon startup sequence this problem originates. There are several source locations for that error message, but none in any obvious way related to the daemon startup. (My C+±Fu is not very strong I have to admit.)

So I have two questions:

  • Does anyone have a suggestion for what to look at?
  • Can anyone confirm that building with --with-prefix (and --with-store-dir) actually works?

Thanks.

does /nix exist when the daemon starts?

Nix still needs /nix/store to exist when manipulating store objects. It’s hardcoded into how nix works. e.g.

$ nix eval .#python3.outPath
"/nix/store/d44wd6n98f93hjr6q1d1phhh1hw7a17d-python3-3.8.8"

No, there is no /nix directory. I’d like to pretend I don’t have root access while I hack on Nix.

I guess I’m gonna have to use a VM to test this.

If the path of the /nix dir is not configurable, what is the intended use of the --with-store-dir flag?

I’m also confused by the fact that there is even a NIX_STORE env var, so how does that square with those paths being hardcoded, as you say?