mirror of
https://github.com/NixOS/nix.git
synced 2025-11-24 19:29:36 +01:00
Misc changes from the flakes branch
This commit is contained in:
parent
c85097da7c
commit
0a10854f85
22 changed files with 110 additions and 60 deletions
|
|
@ -256,4 +256,22 @@ string optimisticLockProfile(const Path & profile)
|
|||
}
|
||||
|
||||
|
||||
Path getDefaultProfile()
|
||||
{
|
||||
Path profileLink = getHome() + "/.nix-profile";
|
||||
try {
|
||||
if (!pathExists(profileLink)) {
|
||||
replaceSymlink(
|
||||
getuid() == 0
|
||||
? settings.nixStateDir + "/profiles/default"
|
||||
: fmt("%s/profiles/per-user/%s/profile", settings.nixStateDir, getUserName()),
|
||||
profileLink);
|
||||
}
|
||||
return absPath(readLink(profileLink), dirOf(profileLink));
|
||||
} catch (Error &) {
|
||||
return profileLink;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue