aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/profiles.cc
diff options
context:
space:
mode:
authorThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2023-01-17 14:15:53 +0100
committerThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2023-01-17 14:17:28 +0100
commit6bdf4edb77bea3fdc006e9b8131a43f4dcd0ee42 (patch)
tree06181a0cc86806fbe806bb2ca4f634ee03a27fc4 /src/libstore/profiles.cc
parentc80621dbacc501f8bf43863438a3df087436d13e (diff)
Keep the default profile the same
It's used as the “system” profile in a bunch of places, so better not touch it. Besides, it doesn't hurt to keep it since it's owned by root any way, so it doesn't have the `chown` problem that the user profiles had and that led to wanting to move them on the client-side.
Diffstat (limited to 'src/libstore/profiles.cc')
-rw-r--r--src/libstore/profiles.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/profiles.cc b/src/libstore/profiles.cc
index ff62d0972..b202351ce 100644
--- a/src/libstore/profiles.cc
+++ b/src/libstore/profiles.cc
@@ -292,7 +292,10 @@ Path getDefaultProfile()
{
Path profileLink = getHome() + "/.nix-profile";
try {
- auto profile = profilesDir() + "/profile";
+ auto profile =
+ getuid() == 0
+ ? settings.nixStateDir + "/profiles/default"
+ : profilesDir() + "/profile";
if (!pathExists(profileLink)) {
replaceSymlink(profile, profileLink);
}