mirror of
https://github.com/NixOS/nix.git
synced 2025-11-12 21:46:01 +01:00
Properly migrate the existing profiles
Make sure that the default profile (including all its generations) are still available after we move it to the user’s home directory
This commit is contained in:
parent
be28cb9262
commit
a2bcf35e0d
1 changed files with 9 additions and 4 deletions
|
|
@ -305,11 +305,16 @@ Path getDefaultProfile()
|
|||
if (!pathExists(profileLink)
|
||||
|| (isLink(profileLink)
|
||||
&& readLink(profileLink) == legacyProfile)) {
|
||||
warn("Migrating the default profile");
|
||||
replaceSymlink(newProfile, profileLink);
|
||||
replaceSymlink(legacyProfile, newProfile);
|
||||
if (pathExists(legacyProfile)) {
|
||||
for (auto & oldGen : findGenerations(legacyProfile).first) {
|
||||
replaceSymlink(
|
||||
oldGen.path,
|
||||
newProfile + "/" + std::string(baseNameOf(oldGen.path)));
|
||||
dirOf(newProfile) + "/"
|
||||
+ std::string(baseNameOf(oldGen.path)));
|
||||
}
|
||||
}
|
||||
}
|
||||
return absPath(readLink(profileLink), dirOf(profileLink));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue