I cannot use /nix for various reasons so I built Nix from source using --with-store-dir=/opt/nix/store and --localstatedir=/opt/nix/var.
Although the install succeeded, anything I try to install errors with BadStorePath and NotInStore. The message is error: path ‘[thepath] is not in the Nix store’