@@ -1328,14 +1328,16 @@ static int _main(int argc, char * * argv)
1328
1328
globals.instSource .systemFilter = " *" ;
1329
1329
1330
1330
if (!pathExists (globals.instSource .nixExprPath )) {
1331
- createDirs (globals.instSource .nixExprPath );
1332
- replaceSymlink (
1333
- fmt (" %s/profiles/per-user/%s/channels" , settings.nixStateDir , getUserName ()),
1334
- globals.instSource .nixExprPath + " /channels" );
1335
- if (getuid () != 0 )
1331
+ try {
1332
+ createDirs (globals.instSource .nixExprPath );
1336
1333
replaceSymlink (
1337
- fmt (" %s/profiles/per-user/root/channels" , settings.nixStateDir ),
1338
- globals.instSource .nixExprPath + " /channels_root" );
1334
+ fmt (" %s/profiles/per-user/%s/channels" , settings.nixStateDir , getUserName ()),
1335
+ globals.instSource .nixExprPath + " /channels" );
1336
+ if (getuid () != 0 )
1337
+ replaceSymlink (
1338
+ fmt (" %s/profiles/per-user/root/channels" , settings.nixStateDir ),
1339
+ globals.instSource .nixExprPath + " /channels_root" );
1340
+ } catch (Error &) { }
1339
1341
}
1340
1342
1341
1343
globals.dryRun = false ;
@@ -1430,14 +1432,18 @@ static int _main(int argc, char * * argv)
1430
1432
1431
1433
if (globals.profile == " " ) {
1432
1434
Path profileLink = getHome () + " /.nix-profile" ;
1433
- if (!pathExists (profileLink)) {
1434
- replaceSymlink (
1435
- getuid () == 0
1436
- ? settings.nixStateDir + " /profiles/default"
1437
- : fmt (" %s/profiles/per-user/%s/profile" , settings.nixStateDir , getUserName ()),
1438
- profileLink);
1435
+ try {
1436
+ if (!pathExists (profileLink)) {
1437
+ replaceSymlink (
1438
+ getuid () == 0
1439
+ ? settings.nixStateDir + " /profiles/default"
1440
+ : fmt (" %s/profiles/per-user/%s/profile" , settings.nixStateDir , getUserName ()),
1441
+ profileLink);
1442
+ }
1443
+ globals.profile = absPath (readLink (profileLink), dirOf (profileLink));
1444
+ } catch (Error &) {
1445
+ globals.profile = profileLink;
1439
1446
}
1440
- globals.profile = absPath (readLink (profileLink), dirOf (profileLink));
1441
1447
}
1442
1448
1443
1449
op (globals, opFlags, opArgs);
0 commit comments