Trouble deciding on package to give priority

Hi there

would someone help me make sense of this error from home-manager switch :

building '/nix/store/w21rwb0kkqfyxxvip2z57hz6v3nsdy72-user-environment.drv'...
error: packages '/nix/store/g374cv5l5rzm2bm3fhr2007kglgs5sbg-home-manager-path/bin/direnv' and '/nix/store/9lmv89njlnakm9qkb6bd9fc0k7i239nj-direnv-2.30.3/bin/direnv' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
error: builder for '/nix/store/w21rwb0kkqfyxxvip2z57hz6v3nsdy72-user-environment.drv' failed with exit code 1;
       last 1 log lines:
       > error: packages '/nix/store/g374cv5l5rzm2bm3fhr2007kglgs5sbg-home-manager-path/bin/direnv' and '/nix/store/9lmv89njlnakm9qkb6bd9fc0k7i239nj-direnv-2.30.3/bin/direnv' have the same priority 5; use 'nix-env --set-flag priority NUMBER INSTALLED_PKGNAME' to change the priority of one of the conflicting packages (0 being the highest priority)
       For full logs, run 'nix log /nix/store/w21rwb0kkqfyxxvip2z57hz6v3nsdy72-user-environment.drv'.

I have tried:

nix-env --set-flag priority 5 direnv-2.30.3

and

nix-env --set-flag priority 0 home-manager-2021-12-25

As these seem to be the relevant installed packages from nix-env -q, but these don’t fix anything. What should I be doing to resolve this?

Thanks

From the error it seems as if you are trying to install direnv through home-manager, while it is already installed throgh nix-env. Remove the nix-env installed one, then re-reun HM.

removed, but same issue, including in new terminal fwiw.

So what is the output of nix-env -q, and please repeat the error from HMs switch again.

fwiw…

$>nix-env -q                                                                                                                                                                            
home-manager-2021-12-25
nix-2.6.0
stdenv-darwin

however, from our other discussion, I’ve tried a sudo nix-channel --update to see if it brings the root channels up to same point as my user channel, and now I have all sorts of other breakages, so I’ll work through those and see where I’m at once thats done.

much thanks

Hey NobbZ, worked through the other resulting issues and one way or another, this problem is resolved, thanks again for your patience and help clearing this up.