about summary refs log tree commit diff
path: root/src/nix
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-08-30T15·14+0200
committerEelco Dolstra <edolstra@gmail.com>2018-08-30T15·14+0200
commitf08b14c9d0e0a1d24b0a5d231ba7d448ef000106 (patch)
tree51da07a1263eb04e9520362e05e0064be18acbf4 /src/nix
parentddeda0b62e1c6cf0594e97dbd25ee3185f408947 (diff)
nix upgrade-nix: Improve error message if 'nix' is not in a profile
E.g.

  $ nix upgrade-nix
  error: directory '/home/eelco/Dev/nix/inst/bin' does not appear to be part of a Nix profile

instead of

  $ nix upgrade-nix
  error: '/home/eelco/Dev/nix/inst' is not a symlink
Diffstat (limited to 'src/nix')
-rw-r--r--src/nix/upgrade-nix.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc
index 666ac68b0a7a..2db60922a9c3 100644
--- a/src/nix/upgrade-nix.cc
+++ b/src/nix/upgrade-nix.cc
@@ -113,7 +113,7 @@ struct CmdUpgradeNix : MixDryRun, StoreCommand
         Path profileDir = dirOf(where);
 
         // Resolve profile to /nix/var/nix/profiles/<name> link.
-        while (baseNameOf(dirOf(canonPath(profileDir))) != "profiles")
+        while (baseNameOf(dirOf(canonPath(profileDir))) != "profiles" && isLink(profileDir))
             profileDir = readLink(profileDir);
 
         printInfo("found profile '%s'", profileDir);