I’m not sure how to describe/ask this succinctly, so please bear with me.
My Linux box runs ArchLinux with nix installed on the side. I’m trying to install a recent version of youtube-dl from nixpkgs-unstable, but what I get seems to be a fairly old version from 2021-05.
- I ran
nix-channel --update
to update my version of nixpkgs to the latest.
- I ran
nix-evaluate --eval -E '(import <nixpkgs> {}).lib.version
to check the version. Found "22.05pre351617.942b0817e89"
.
- Confirmed commit
942b0817e89
is the latest “release” of nixpkgs-unstable by checking https://nixos.org/channels . Now there is a link for nixpkgs-unstable that confirms this commit is correct.
When I run nix shell nixpkgs#youtube-dl
, it installs version 2021.05.16
of youtube-dl
.
If I run nix-shell -p youtube-dl
, it installs version 2021.12.17
of youtube-dl
.
I searched for the flake registry and found a file that indicated nixpkgs
is an alias for nixpkgs-unstable
[1], yet nix shell
is following some other commit.
So, I guess my question is, what needs to be done to fix this?
Is this a bug?
If not, why is the UX team creating new tools that are desynchronized with channel names used by the old tools, and creating this confusing ambiguity? I’ve lost over an hour trying to sort this out on my own before I even considered that nix shell nixpkgs#
doesn’t follow my nix-channel
, let alone that it doesn’t follow the github channel.
[1]: https://github.com/NixOS/flake-registry/blob/c4ed6ef2f582dd260c06bf600232ff0568aebf4c/flake-registry.json#L183
For some reason beyond my comprehension, I cannot figure this stuff out in a timely fashion until I post a query online…
So I decided to look through the nix toolbox and see if any of the other commands in there might shed some light.
I found nix flake show
.
$ nix flake show nixpkgs
github:NixOS/nixpkgs/efee454783c5c14ae78687439077c1d3f0544d97
├───checks
│ └───x86_64-linux
│ └───tarball: derivation 'nixpkgs-tarball-21.05pre20210522.efee454'
├───htmlDocs: unknown
├───legacyPackages
├───lib: unknown
└───nixosModules
└───notDetected: NixOS module
Okay. pre20210522 explains the youtube-dl version I got from nix shell
.
Let’s try nix registry list
.
$ nix registry list
user flake:nixpkgs github:NixOS/nixpkgs/efee454783c5c14ae78687439077c1d3f0544d97
...
global flake:nix github:NixOS/nix
global flake:nixops github:NixOS/nixops
global flake:nixos-hardware github:NixOS/nixos-hardware
global flake:nixos-homepage github:NixOS/nixos-homepage/flake
...
Which of these things is not like the other? I imagine that user
designation is the culprit.
So, nix flake update nixpkgs
won’t update that registry entry.
Let’s try nix registry pin nixpkgs
.
$ nix flake show nixpkgs
github:NixOS/nixpkgs/942b0817e898262cc6e3f0a5f706ce09d8f749f1
├───checks
│ └───x86_64-linux
│ └───tarball: derivation 'nixpkgs-tarball-22.05pre20220206.942b081'
├───htmlDocs: unknown
├───legacyPackages
├───lib: unknown
└───nixosModules
└───notDetected: NixOS module
And now the nixpkgs channel is up to date and nix shell nixpkgs#youtube-dl
is the latest version: 21.12.17.
So to answer my own questions:
- No, it’s not a bug. It’s operator headspace.
- The nix tools intentionally allow us to pin a registry entry so we can hold at a working version of a channel. But it is incumbent for us to remember that we did so, and use the appropriate tool to update.