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
This commit is contained in:
Eelco Dolstra 2018-08-30 17:14:17 +02:00
parent ddeda0b62e
commit f08b14c9d0
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -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);