diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2020-04-02 11:54:48 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2020-04-03 20:14:34 +0200 |
commit | 63fa92605b2b0a8a6d948a27e1d331cc46b199bd (patch) | |
tree | 9ef9d35a00c7b08945ede1260b195ab75ec406c0 | |
parent | 47c568ee3246d958b53e4496fa393880be611e8f (diff) |
nix-env: Refuse to operate on a new-style profile
This prevents users from accidentally nuking their profile via
nix-env.
(cherry picked from commit 021634e3e3edb327089d33ab41b743f0a40126da)
-rw-r--r-- | src/nix-env/user-env.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/nix-env/user-env.cc b/src/nix-env/user-env.cc index 717431b7a..f852916d8 100644 --- a/src/nix-env/user-env.cc +++ b/src/nix-env/user-env.cc @@ -15,6 +15,8 @@ namespace nix { DrvInfos queryInstalled(EvalState & state, const Path & userEnv) { 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"; if (pathExists(manifestFile)) { Value v; |