nix-env: Refuse to operate on a new-style profile

This prevents users from accidentally nuking their profile via
nix-env.
This commit is contained in:
Eelco Dolstra 2020-04-02 11:54:48 +02:00
parent ed13457dbf
commit 021634e3e3

View file

@ -15,6 +15,8 @@ namespace nix {
DrvInfos queryInstalled(EvalState & state, const Path & userEnv) DrvInfos queryInstalled(EvalState & state, const Path & userEnv)
{ {
DrvInfos elems; DrvInfos elems;
if (pathExists(userEnv + "/manifest.json"))
throw Error("profile '%s' is incompatible with 'nix-env'; please use 'nix profile' instead", userEnv);
Path manifestFile = userEnv + "/manifest.nix"; Path manifestFile = userEnv + "/manifest.nix";
if (pathExists(manifestFile)) { if (pathExists(manifestFile)) {
Value v; Value v;