Path to channel is a symlink error when running commands

I have a fresh install of Nix (multi-user) on Mac OS, x86.
Whenever I try running any command (for instance nix-shell -p hello), I get an error saying that:

error: path '/nix/var/nix/profiles/per-user/root/channels' is a symlink

so basically it seems I cannot use any basic nix command.
It is indeed a symlink but I have another computer (Mac OS ARM), for which this is also symlinked in the same way.
What is wrong ?

1 Like

A symlink to what? And how did you install nix?

I installed nix using sh <(curl -L https://nixos.org/nix/install)

The symlink is as follows:

> ls -l /nix/var/nix/profiles/per-user/root/channels
lrwxr-xr-x  1 alireza.sepidbar  nixbld  15 Jan 23 13:52 /nix/var/nix/profiles/per-user/root/channels -> channels-1-link
> ls -l /nix/var/nix/profiles/per-user/root/channels-1-link
lrwxr-xr-x  1 alireza.sepidbar  nixbld  60 Jan 23 13:52 /nix/var/nix/profiles/per-user/root/channels-1-link -> /nix/store/nnjcz4xj38l5jyvcxjb8hr8fkm0s74lh-user-environment

On my other computer, it’s the same except owner is root for some reason:

> ls -l /nix/var/nix/profiles/per-user/root/channels
lrwxr-xr-x  1 root  nixbld  15 20 déc  2023 /nix/var/nix/profiles/per-user/root/channels -> channels-2-link
> ls -l /nix/var/nix/profiles/per-user/root/channels-2-link
lrwxr-xr-x  1 root  nixbld  60 20 déc  2023 /nix/var/nix/profiles/per-user/root/channels-2-link -> /nix/store/spiny4irr08i2vzqz5xzck6acpcfl1w5-user-environment

Hi, i am a total newbie to nix, and i am somehow happy that someone else has the same problem :-/

I installed nix yesterday by curl -L https://nixos.org/nix/install | sh - needed to fix my PATH to get nix-shell into it, but i run into that error:

aleks@silberfisch : ~
[0] % nix-shell -p nix-info --run "nix-info -m"
error:
       … while calling the 'import' builtin
         at «string»:1:18:
            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (nix-info) ]; } ""
             |                  ^

       … while realising the context of a path

       … while calling the 'findFile' builtin
         at «string»:1:25:
            1| {...}@args: with import <nixpkgs> args; (pkgs.runCommandCC or pkgs.runCommand) "shell" { buildInputs = [ (nix-info) ]; } ""
             |                         ^

       error: path '/nix/var/nix/profiles/per-user/root/channels' is a symlink

aleks@silberfisch : ~
[1] % ls -la /nix/var/nix/profiles/per-user/root/channels
lrwxr-xr-x 1 root 15 Jan 24 10:53 /nix/var/nix/profiles/per-user/root/channels -> channels-1-link

aleks@silberfisch : ~
[0] % ls -la /nix/var/nix/profiles/per-user/root/channels-1-link
lrwxr-xr-x 1 root 60 Jan 24 10:53 /nix/var/nix/profiles/per-user/root/channels-1-link -> /nix/store/h2mk68qji9aag7ljssnxgvy18yy4hmbw-user-environment

I am not sure what i should expect as this is my first try.
I run macos 15.2 - will install nix now on a linux vm to dig deeper into that, if possible

Seems like i do not have the group nixbld as there is only a numeric value…

This is fixed in Nix 2.26.1.

2 Likes

Confirmed, its working now.

Thank you for your work!
Aleks