From f08b14c9d0e0a1d24b0a5d231ba7d448ef000106 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 30 Aug 2018 17:14:17 +0200 Subject: [PATCH] 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 --- src/nix/upgrade-nix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nix/upgrade-nix.cc b/src/nix/upgrade-nix.cc index 666ac68b0..2db60922a 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/ link. - while (baseNameOf(dirOf(canonPath(profileDir))) != "profiles") + while (baseNameOf(dirOf(canonPath(profileDir))) != "profiles" && isLink(profileDir)) profileDir = readLink(profileDir); printInfo("found profile '%s'", profileDir);