mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-26 15:56:18 +02:00
nix-env: Ignore failures creating ~/.nix-profile and ~/.nix-defexpr
https://hydra.nixos.org/build/102803093
This commit is contained in:
parent
bda64a2b0f
commit
c3aaf3b8da
1 changed files with 20 additions and 14 deletions
|
@ -1325,14 +1325,16 @@ static int _main(int argc, char * * argv)
|
||||||
globals.instSource.systemFilter = "*";
|
globals.instSource.systemFilter = "*";
|
||||||
|
|
||||||
if (!pathExists(globals.instSource.nixExprPath)) {
|
if (!pathExists(globals.instSource.nixExprPath)) {
|
||||||
createDirs(globals.instSource.nixExprPath);
|
try {
|
||||||
replaceSymlink(
|
createDirs(globals.instSource.nixExprPath);
|
||||||
fmt("%s/profiles/per-user/%s/channels", settings.nixStateDir, getUserName()),
|
|
||||||
globals.instSource.nixExprPath + "/channels");
|
|
||||||
if (getuid() != 0)
|
|
||||||
replaceSymlink(
|
replaceSymlink(
|
||||||
fmt("%s/profiles/per-user/root/channels", settings.nixStateDir),
|
fmt("%s/profiles/per-user/%s/channels", settings.nixStateDir, getUserName()),
|
||||||
globals.instSource.nixExprPath + "/channels_root");
|
globals.instSource.nixExprPath + "/channels");
|
||||||
|
if (getuid() != 0)
|
||||||
|
replaceSymlink(
|
||||||
|
fmt("%s/profiles/per-user/root/channels", settings.nixStateDir),
|
||||||
|
globals.instSource.nixExprPath + "/channels_root");
|
||||||
|
} catch (Error &) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
globals.dryRun = false;
|
globals.dryRun = false;
|
||||||
|
@ -1427,14 +1429,18 @@ static int _main(int argc, char * * argv)
|
||||||
|
|
||||||
if (globals.profile == "") {
|
if (globals.profile == "") {
|
||||||
Path profileLink = getHome() + "/.nix-profile";
|
Path profileLink = getHome() + "/.nix-profile";
|
||||||
if (!pathExists(profileLink)) {
|
try {
|
||||||
replaceSymlink(
|
if (!pathExists(profileLink)) {
|
||||||
getuid() == 0
|
replaceSymlink(
|
||||||
? settings.nixStateDir + "/profiles/default"
|
getuid() == 0
|
||||||
: fmt("%s/profiles/per-user/%s/profile", settings.nixStateDir, getUserName()),
|
? settings.nixStateDir + "/profiles/default"
|
||||||
profileLink);
|
: fmt("%s/profiles/per-user/%s/profile", settings.nixStateDir, getUserName()),
|
||||||
|
profileLink);
|
||||||
|
}
|
||||||
|
globals.profile = absPath(readLink(profileLink), dirOf(profileLink));
|
||||||
|
} catch (Error &) {
|
||||||
|
globals.profile = profileLink;
|
||||||
}
|
}
|
||||||
globals.profile = absPath(readLink(profileLink), dirOf(profileLink));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
op(globals, opFlags, opArgs);
|
op(globals, opFlags, opArgs);
|
||||||
|
|
Loading…
Reference in a new issue