1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 22:11:15 +02:00

Factor out the generation of the profile/channel directory

Make sure that all the code paths use the same one, and that the
backwards-compatibility measures are probably in place when needed
This commit is contained in:
Théophane Hufschmitt 2023-03-21 13:37:19 +01:00
parent 82bd9535dd
commit fb67c1a1fb
5 changed files with 40 additions and 15 deletions

View file

@ -1403,11 +1403,11 @@ static int main_nix_env(int argc, char * * argv)
try {
createDirs(globals.instSource.nixExprPath);
replaceSymlink(
fmt("%s/profiles/per-user/%s/channels", settings.nixStateDir, getUserName()),
defaultChannelsDir(),
globals.instSource.nixExprPath + "/channels");
if (getuid() != 0)
replaceSymlink(
fmt("%s/profiles/per-user/root/channels", settings.nixStateDir),
rootChannelsDir(),
globals.instSource.nixExprPath + "/channels_root");
} catch (Error &) { }
}