How to find the latest NixOS stable release channel
porkrind.org·21w
📂Git
Preview
Report Post

I wanted to make a script that updated to the latest nix channel automatically when it was released, the same way I do with my Debian boxes.

Nix doesn’t have any nice way of querying the list of channels programmatically, but you can query their git repository since releases are created as branches there:

git ls-remote --sort=-v:refname https://github.com/NixOS/nixpkgs 'nixos-??.??' | awk '{ sub("^.*/","",$2); print $2; exit}'

This leverages the git ls-remote command. Here’s an explanation of the arguments:

nixos-??.??: only show remote branches/tags that match this pattern. If you wanted to match a different official channel typ…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help