aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-04-02 11:54:48 +0200
committerEelco Dolstra <edolstra@gmail.com>2020-04-02 11:54:48 +0200
commit021634e3e3edb327089d33ab41b743f0a40126da (patch)
tree8f90f07c605ae5847bc8fcd709b777c27e006da7 /src
parented13457dbf1a78f47f760e349985b23dfd5f16c4 (diff)
nix-env: Refuse to operate on a new-style profile
This prevents users from accidentally nuking their profile via nix-env.
Diffstat (limited to 'src')
-rw-r--r--src/nix-env/user-env.cc2
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;