Nix-channel --update doesn't update anything, my nixpkgs-unstable channel is months old

Currently using nix-channel 2.18.1 on MacOS. I’ve also tried nix-channel 2.21.2 with the same results:

$ nix-channel --update
unpacking channels...

Nothing gets updated. In particular I’m looking to update nixUnstable, but nix-build -A nixUnstable '<nixpkgs>' still gives me:

/nix/store/xddsxyp60qq5jmdxb9rkwbvxzxa4lhar-nix-2.19.3

I’m on nixpkgs-unstable, which is supposed to have v2.21 as nixUnstable. The version I’m seeing matches the state of the repository in my channel, which is using a commit from 3 months ago:

$ cat ~/.local/state/nix/profiles/channels-4-link/nixpkgs/svn-revision
592652.f945939fd679

I timed the nix-channel --update command and it takes ~0.1s, so it doesn’t seem to be doing much. I don’t think it’s just caching results from the last hour, as the current generation is months old:

$ nix-channel --list-generations
   1   2023-10-02 14:56:04
   2   2023-10-02 15:04:52
   3   2024-03-08 09:52:07   (current)

I tried re-adding the nixpkgs channel under a different name (nixpkgs-unstable), and it took much longer so I hoped it was fetching the latest. It created a new generation:

$ nix-channel --list
nixpkgs https://nixos.org/channels/nixpkgs-unstable
nixpkgs-unstable https://nixos.org/channels/nixpkgs-unstable

$ nix-channel --list-generations
   1   2023-10-02 14:56:04
   2   2023-10-02 15:04:52
   3   2024-03-08 09:52:07
   4   2024-04-25 10:46:04   (current)

But it looks like that time was just spent unpacking, as it resulted in the same git revision as my long-running nixpkgs channel:

$ cat ~/.local/state/nix/profiles/channels-4-link/nixpkgs{,-unstable}/svn-revision
592652.f945939fd679
592652.f945939fd679

I also tried removing ~/.cache/nix, but no change (after re-running the update).

Any ideas? I’m getting tempted to somehow update various symlinks myself, but I’d much rather do it properly.

What’s the output to nix-channel --update with --verbose?

$ nix-channel --update nixpkgs --verbose
downloading 'https://nixos.org/channels/nixpkgs-unstable'...
downloading 'https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre615524.1e1dc66fe689/nixexprs.tar.xz'...
unpacking channels...

(I have the same nixpkgs channel).

Nothing different, I had assumed it didn’t even understand the flag until I saw your output:

$ nix-channel --update nixpkgs --verbose
unpacking channels...

The --verbose option shows up in --help. Now I see it ought to show more verbosity when given more: -vvvv or -vvvvv hopefully gives a better clue.

Oh thanks, yes that does print more:

performing daemon worker op: 11
acquiring write lock on '/nix/var/nix/temproots/31794'
performing daemon worker op: 1
using cache entry '{"name":"nixpkgs-unstable","type":"file","url":"https://nixos.org/channels/nixpkgs-unstable"}' -> '{"etag":"\"131f93c4c5100676571e65311dbfc044\"","url":"https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre615524.1e1dc66fe689"}', '/nix/store/r693fnz4dbr60va5sjvxrf20z3hrjx4n-nixpkgs-unstable'
performing daemon worker op: 11
performing daemon worker op: 1
using cache entry '{"name":"nixexprs.tar.xz","type":"file","url":"https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre615524.1e1dc66fe689/nixexprs.tar.xz"}' -> '{"etag":"\"2fffcf24a2219e677b7ed91c1ca33b13\"","url":"https://releases.nixos.org/nixpkgs/nixpkgs-24.05pre615524.1e1dc66fe689/nixexprs.tar.xz"}', '/nix/store/lc9w2q4jbfkifwkcazwkkyiiy3p3dp77-nixexprs.tar.xz'
unpacking channels...

That version looks new (only 3 days old). So nix-channel seems aware of newer versions, but isn’t unpacking them (or they’re not going where I expect). The svn-revision file in that nixexprs.tar.xz matches the URL, so it’s definitely got newer expressions in the nix store :confused:

Still no real idea why this was happening, but I noticed it was using the nix daemon. So as root, I removed ~root/.cache/nix. I also removed my own ~/.cache/nix, although I’d already tried that.

On the next run nix-channel --update successfully updated nixpkgs :partying_face: . I don’t have the verbose logs though because my terminal buffer got flooded with download thread waiting for 100 ms lines :man_shrugging:

Thanks for the help @rgoulter!

1 Like