1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 22:33:57 +02:00

nix-env: Ignore failures creating ~/.nix-profile and ~/.nix-defexpr

https://hydra.nixos.org/build/102803093
(cherry picked from commit c3aaf3b8da)
This commit is contained in:
Eelco Dolstra 2019-10-10 09:14:05 +02:00
parent e3d44a3b83
commit 21f48ff26a
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -1328,6 +1328,7 @@ static int _main(int argc, char * * argv)
globals.instSource.systemFilter = "*"; globals.instSource.systemFilter = "*";
if (!pathExists(globals.instSource.nixExprPath)) { if (!pathExists(globals.instSource.nixExprPath)) {
try {
createDirs(globals.instSource.nixExprPath); createDirs(globals.instSource.nixExprPath);
replaceSymlink( replaceSymlink(
fmt("%s/profiles/per-user/%s/channels", settings.nixStateDir, getUserName()), fmt("%s/profiles/per-user/%s/channels", settings.nixStateDir, getUserName()),
@ -1336,6 +1337,7 @@ static int _main(int argc, char * * argv)
replaceSymlink( replaceSymlink(
fmt("%s/profiles/per-user/root/channels", settings.nixStateDir), fmt("%s/profiles/per-user/root/channels", settings.nixStateDir),
globals.instSource.nixExprPath + "/channels_root"); globals.instSource.nixExprPath + "/channels_root");
} catch (Error &) { }
} }
globals.dryRun = false; globals.dryRun = false;
@ -1430,6 +1432,7 @@ static int _main(int argc, char * * argv)
if (globals.profile == "") { if (globals.profile == "") {
Path profileLink = getHome() + "/.nix-profile"; Path profileLink = getHome() + "/.nix-profile";
try {
if (!pathExists(profileLink)) { if (!pathExists(profileLink)) {
replaceSymlink( replaceSymlink(
getuid() == 0 getuid() == 0
@ -1438,6 +1441,9 @@ static int _main(int argc, char * * argv)
profileLink); profileLink);
} }
globals.profile = absPath(readLink(profileLink), dirOf(profileLink)); globals.profile = absPath(readLink(profileLink), dirOf(profileLink));
} catch (Error &) {
globals.profile = profileLink;
}
} }
op(globals, opFlags, opArgs); op(globals, opFlags, opArgs);