You’ll want to set your nixpkgs channel to follow the release you want to “upgrade to”. Then you need to use “re-run” the command which consumes that channel
After listing I went ahead and removed unstable and nixos since I was getting this error:
warning: name collision in input Nix expressions, skipping '/Users/jeffhykin/.nix-defexpr/channels_root/nixpkgs'
Removing them, then running nix-channel --update followed again with nix-env -u '*' seems to be doing a whole lot of something (installing), so I’ll add a post once its finished
I’m just now realizing nix-env -u '*' is updating every individual package. I was about to say that wasn’t what I wanted to do, since the bug causes nix-env -qa --json to fail and I thought nix-env itself needed to be updated.
But the bug is gone now! So there must be something interestingly recursive about nix-env I don’t understand.
As a slight downside, I’m now getting the following warning with every command, even though I’m only subscribed to one channel now
warning: name collision in input Nix expressions, skipping '/Users/jeffhykin/.nix-defexpr/channels_root/nixpkgs'
Just to close the circle, the fix for the nix-env -qa --json bug on Darwin doesn’t involve the nix executable at all. Rather, it’s a fix within the nixpkgs collection of Nix expressions.
So just updating nixpkgs to a recent enough version is all you need to get the fix, as you discovered.
Although this is a bit off topic, if I use the -f option for an older commit (example below) will I basically be re-introducing the bug? (will the nix-env be using the -f packages, or only looking/searching them)
I made the mistake of adding the unstable channel to my user channels. Running sudo nix-channel --list revealed that the system channel was still on 21.11 and updating that fixed the issue.