I have a relatively freshly setup NixOS 24.11. I have added the unstable channel using the nix-channel command (not declarative).
I am not sure if by default a channel is set. I heard that people run NixOS without channels?
By default NixOS is configured stable. Editing the /etc/nixos/configuration.nix and setting the system.stateVersion to unstable does not work. I have no idea why, as this would make a lot of sense.
Non-Declarative way
I removed the stable channel and added the unstable one
You cannot, this is an inherent flaw in the design of channels.
If you want to have a fully declarative NixOS configuration, you need to stop using channels and either use flakes or niv.
Using flakes can be helpful since it also enforces pure evaluation, which means that you cannot accidentally depend on something without realizing it’s impure (e.g. importing from something included via <>, or a builtins.readFile outside your flake or such), but they’re experimental and come with a bunch of baggage. niv is fully usable today, but you still need to know what you’re doing to avoid having reproducibility holes in your configuration.
@tlater I dont use flakes (yet) and tried using channels with no success. So no reason for such annoyed comments.
I have read the comment in the config now and it makes sense. I have changed that back to the initial 24.11 and added the unstable channel as per the docs
It seems that here I can set a different input URL declaratively. But rebuilding the system still shows the undefined packages, even though the only channel is the unstable channel, and the input is unstable??
I removed the channel, still the same issue. The package only in unstable is not found.
I’m not sure what you’re referring to here, I’m just explaining that precisely what you’re asking for is not possible, and giving you alternatives.
Unless it’s the thing about stateVersion, in which case sorry if the tone came off wrong, but I think you genuinely just misread what @waffle8946 was saying.
Is what you actually want to do just using unstable with channels then?
If I understand what you did correctly, you now have only one channel on your system, which is named nixos and points to nixos-unstable. This should let you use unstable, yes, assuming you also updated your channels at some point.
What is it that you’re actually trying to achieve by switching to unstable? Why do you think this package exists, and why do you think it’s in unstable? I think we’ll be able to help better if you explain the background here.