Discord package versions don't align with search results on nixos.org

Hi,
Summary:
Expected outcome:
Install discord 0.0.22 (current available version) in user env (nix env…) from unstable channel (system-wide channel is stable)

What output did you get:
‘nix-env -qaP discord’ results in ‘nixos.discord discord-0.0.21’

Meta information like system and nix versions:
Nixos 22.11
nix-channel --list result shows…
nixos nixos-unstable release nixos-23.05pre437883.1eb875e811d

Long version:
I’m trying to install discord. Version 0.0.21 is out of date and so I cannot use it. A search reveals version 0.0.22 is in the unstable channel. I waited a few days to see if the stable branch got updated, but it didn’t.

So I intend to temporarily use the unstable version at a user level and update the system later when stable catches up.

So I added the unstable channel to my user env (nix-channel --add nixos-unstable release nixos-23.05pre437883.1eb875e811d) and query the package (nix-env -qaP discord). The results is ‘nixos.discord discord-0.0.21’

So what am I dong wrong (having read the various docs I think I am using the correct approach)? - TIA

By default nix-env -qaP just searches what it finds in ~/.nix-defexpr/channels/nixpkgs and falls back to ~/.nix-defexpr/root_channels/nixos`.

If you want to search from some other location you have tp specify that:

$ nix-env -f '<nixpkgs2111>' -qaP discord
discord  discord-0.0.17

(nixpkgs2111 here is for some older channel I have a nix path entry for, for reasons I long have forgotten, but it serves the purpose of an example well)

Installing then should work similarily using nix-env -f '<nixpkgs2111> -iA discord.

Though be aware that using nix-env this way is usually a bad idea, instead you probably want to use your systems configuration or home-manager for installing discord in a newer version.

PS: a backport has been created, and if it builds on my machine, I will merge quickly. You can follow its progress through the backporting on the PR tracker

@NobbZ Thanks for the post - and I now have the updated version.

I’ll look into home-manager (I use nix-env as a longer term nix-shell, and do not do this for anything I want to keep (app or config) or version control). I continue to learn :slight_smile: