nix-env: Create ~/.nix-defexpr automatically
(cherry picked from commit c9159f86cc9a2fc07e2ab1217c2d8a8824123df4)
This commit is contained in:
parent
f66108f738
commit
0fb4744467
3 changed files with 12 additions and 30 deletions
|
|
@ -193,12 +193,6 @@ static void loadDerivations(EvalState & state, Path nixExprPath,
|
|||
}
|
||||
|
||||
|
||||
static Path getDefNixExprPath()
|
||||
{
|
||||
return getHome() + "/.nix-defexpr";
|
||||
}
|
||||
|
||||
|
||||
static long getPriority(EvalState & state, DrvInfo & drv)
|
||||
{
|
||||
return drv.queryMetaInt("priority", 0);
|
||||
|
|
@ -1330,9 +1324,20 @@ static int _main(int argc, char * * argv)
|
|||
Globals globals;
|
||||
|
||||
globals.instSource.type = srcUnknown;
|
||||
globals.instSource.nixExprPath = getDefNixExprPath();
|
||||
globals.instSource.nixExprPath = getHome() + "/.nix-defexpr";
|
||||
globals.instSource.systemFilter = "*";
|
||||
|
||||
if (!pathExists(globals.instSource.nixExprPath)) {
|
||||
createDirs(globals.instSource.nixExprPath);
|
||||
replaceSymlink(
|
||||
fmt("%s/profiles/per-user/%s/channels", settings.nixStateDir, getUserName()),
|
||||
globals.instSource.nixExprPath + "/channels");
|
||||
if (getuid() != 0)
|
||||
replaceSymlink(
|
||||
fmt("%s/profiles/per-user/root/channels", settings.nixStateDir),
|
||||
globals.instSource.nixExprPath + "/channels_root");
|
||||
}
|
||||
|
||||
globals.dryRun = false;
|
||||
globals.preserveInstalled = false;
|
||||
globals.removeAll = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue