aboutsummaryrefslogtreecommitdiff
path: root/src/nix-channel
diff options
context:
space:
mode:
authorThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2023-03-20 10:24:48 +0100
committerThéophane Hufschmitt <theophane.hufschmitt@tweag.io>2023-03-23 10:22:42 +0100
commit82bd9535dd663209a38c1e6ebd8867875fa363ef (patch)
tree53644611cba17cc9c2e84da61e907b9a5283e2e8 /src/nix-channel
parent918ca8b3a351e6c48ac1f8cc269355304ad11f8a (diff)
nix-channel: Restore the old root channels directory
Diffstat (limited to 'src/nix-channel')
-rwxr-xr-xsrc/nix-channel/nix-channel.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/nix-channel/nix-channel.cc b/src/nix-channel/nix-channel.cc
index 338a7d18e..a79354404 100755
--- a/src/nix-channel/nix-channel.cc
+++ b/src/nix-channel/nix-channel.cc
@@ -168,7 +168,13 @@ static int main_nix_channel(int argc, char ** argv)
nixDefExpr = settings.useXDGBaseDirectories ? createNixStateDir() + "/defexpr" : home + "/.nix-defexpr";
// Figure out the name of the channels profile.
- profile = profilesDir() + "/channels";
+ // For backwards-compatibility, install the root channels under
+ // a custom location, as these are also used as "global" channeles, and
+ // their location is hardcoded in a number of places.
+ profile = getuid() == 0
+ ? settings.nixStateDir + "/profiles/per-user/root/channels"
+ : profilesDir() + "/channels";
+ createDirs(dirOf(profile));
enum {
cNone,