aboutsummaryrefslogtreecommitdiff
path: root/src/nix-env
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-10-21 16:07:19 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-10-21 16:07:19 +0200
commita7aabd7cc785bbf34ad29101672677ced18a7fdd (patch)
treee5635720323ddfe9d2070370c91c6f3e4d566dbb /src/nix-env
parenta07da2fd7a889c225847556c0d4bf88384995274 (diff)
Add getDefaultProfile() function
Diffstat (limited to 'src/nix-env')
-rw-r--r--src/nix-env/nix-env.cc17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/nix-env/nix-env.cc b/src/nix-env/nix-env.cc
index 199dc92aa..5ac0eb87c 100644
--- a/src/nix-env/nix-env.cc
+++ b/src/nix-env/nix-env.cc
@@ -1427,21 +1427,8 @@ static int _main(int argc, char * * argv)
if (globals.profile == "")
globals.profile = getEnv("NIX_PROFILE", "");
- if (globals.profile == "") {
- Path profileLink = getHome() + "/.nix-profile";
- try {
- if (!pathExists(profileLink)) {
- replaceSymlink(
- getuid() == 0
- ? settings.nixStateDir + "/profiles/default"
- : fmt("%s/profiles/per-user/%s/profile", settings.nixStateDir, getUserName()),
- profileLink);
- }
- globals.profile = absPath(readLink(profileLink), dirOf(profileLink));
- } catch (Error &) {
- globals.profile = profileLink;
- }
- }
+ if (globals.profile == "")
+ globals.profile = getDefaultProfile();
op(globals, opFlags, opArgs);