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.
This commit is contained in:
Théophane Hufschmitt 2023-01-17 14:15:53 +01:00
parent c80621dbac
commit 6bdf4edb77

View file

@ -292,7 +292,10 @@ Path getDefaultProfile()
{ {
Path profileLink = getHome() + "/.nix-profile"; Path profileLink = getHome() + "/.nix-profile";
try { try {
auto profile = profilesDir() + "/profile"; auto profile =
getuid() == 0
? settings.nixStateDir + "/profiles/default"
: profilesDir() + "/profile";
if (!pathExists(profileLink)) { if (!pathExists(profileLink)) {
replaceSymlink(profile, profileLink); replaceSymlink(profile, profileLink);
} }