fix fallback chroot store creation after b247ef72d

When /nix/var (or, more precisely, NIX_STATE_DIR) does not exist at all,
Lix falls back to creating an adhoc chroot store in XDG_DATA_HOME.

b247ef72d[1] changed the way Store classes are initialized, and in the
migration, a `params2` was accidentally changed to `params`. This commit
restores the correct behavior, and in lieu of a single *character* fix,
this commit also changes the variable name to something more reasonable.

Fixes #274.

[1]: b247ef72dc

n.b., this code might deserve some more looking at anyway. this fallback
store creation throws away *all* Store params passed to
openFromNonUri() in favor of an entirely new set which only contains
the `root` param, which may or may not be the correct behavior

Change-Id: Ibea559b88a50e6d6e75a1f87d9d7816cabb2a8f3
This commit is contained in:
Qyriad 2024-05-06 20:54:21 -06:00
parent 241b9992fd
commit 005b2b61e6

View file

@ -1444,9 +1444,10 @@ std::shared_ptr<Store> openFromNonUri(const std::string & uri, const Store::Para
warn("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore);
} else
debug("'%s' does not exist, so Nix will use '%s' as a chroot store", stateDir, chrootStore);
Store::Params params2;
params2["root"] = chrootStore;
return LocalStore::makeLocalStore(params);
Store::Params chrootStoreParams;
chrootStoreParams["root"] = chrootStore;
// FIXME? this ignores *all* store parameters passed to this function?
return LocalStore::makeLocalStore(chrootStoreParams);
}
#endif
else