I want to use the latest version of hugo through a nix-shell
like so
nix-shell -p **hugo**
but I want the package from the unstable channel
how can I run that from unstable?
I want to use the latest version of hugo through a nix-shell
like so
nix-shell -p **hugo**
but I want the package from the unstable channel
how can I run that from unstable?
nix-shell -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/nixpkgs-unstable.tar.gz -p **hugo**
-I overrides the NIX_PATH which nix uses to look up the packages in.
Thank for this answer! Is there a shorter version of this command when the unstable is already a channel? (So i don’t have to remember the url) E.g.
sudo nix-channel --list
nixos https://nixos.org/channels/nixos-24.05
unstable https://nixos.org/channels/nixos-unstable
# something like this, but does not work
nix-shell -p nixos-unstable.hugo
# does not work either
nix-shell -I nixos-unstable -p hugo
(btw, i tried this, but nothing worked. i think because the post is old and interfaces has changed. I mean this would work but its not really shorter either nix-shell -I nixpkgs=/nix/var/nix/profiles/per-user/root/channels/unstable -p hugo)
nix-shell -I nixpkgs=channel:nixos-unstable -p hugo works. This channel: syntax seems to only be documented well under docs for the new nix CLI.
Also, if you have flakes enabled, you can do e.g. nix shell github:NixOS/nixpkgs/nixos-unstable#hugo. You can also try nix shell nixpkgs#hugo, since the default for nixpkgs in the registry is nixpkgs-unstable:
$ nix registry list | grep flake:nixpkgs
global flake:nixpkgs github:NixOS/nixpkgs/nixpkgs-unstable
but if your system is using a flake, that might point to the nixpkgs for that flake instead.
You can pretty trivially add unstable to the registry though, if you need this a lot.
For completenes, if you want to do that with your own normal user (non-root) nix-channels:
nix-channel --list
home-manager https://github.com/nix-community/home-manager/archive/release-25.11.tar.gz
nixpkgs https://nixos.org/channels/nixos-25.11
unstable https://nixos.org/channels/nixos-unstable
nix-channel --update
nix-shell -I nixpkgs=$HOME/.nix-defexpr/channels/unstable -p zed-editor