Thereās nothing keeping you from using an unstable package on stable; you can get a reference to unstable via import <nixpkgs-unstable> (if your channel is named that), or niv/flakes if you live in the future.
Whether this is sensible to begin with is a different question. I think using future nix is unlikely to actually cause problems in this case, but you are throwing the stability guarantees of the stable branch out of the window; nix may have changed in a way that breaks nixpkgs, after all.
I think best practice would be to backport nix 2.6 upstream, going through test processes while youāre at it. I suspect that itās just a case of nobody getting around to that backport yet.
I avoid channels and NIX_PATH like the plague. To my mind they defeat the whole point of Nix. (So it irks me that upgrading NixOS itself requires messing around with channels. (Unless Iāve missed something (hope I have!)))
Iāve been avoiding niv, pinning stuff by hand, waiting until I go full-flake. (Iām now trying to go full-flake.)
Yes, Iām trying to move to the future.
But Iām drawing a blank on how I would do this with a flake. Probably because all my flakes explorations have been about development environments for projects, and I havenāt got around to flakifying home-manager or configuration.nix.
Ah, I live in the future, for those exact reasons, but assume people donāt if they ask questions so I donāt overload them with a bunch of flakes context when theyāre learning Point out youāre using flakes when asking, that makes it easier to pin down what answer youāre looking for.
Itās much, much nicer with flakes. You would add a second input for unstable:
As with flakes in general, this gives you pinning through flake.lock, and sorts out pulling in updates with nix flake update.
Then, the choice is yours. You need to take that nixpkgs-unstable, and
somehow prop it into the same place you define nix.package. You can
do that via an overlay, _module.args, or simply by setting nix.package in flake.nix, so you still have access to that
nixpkgs-unstable variable.
Note that nixpkgs exposes its packages through nixpkgs-unstable.legacyPackages, so if Iām not mistaken a direct reference to nix 2.6 would be nixpkgs-unstable.legacyPackages."x86_64".nix_2_6.
I am at the stage of flakifying my development projects but have been avoiding touching my NixOS and home-manager configurations (for the time being). As this was a question about managing NixOS, I didnāt really want a flakey answer, at present.
But Iāll be getting there soon, so thanks for you flake example: it will be useful to me Any Time Now.
I guess that the pragmatic course of action for me, for now, is to forget about nix 2.6: 2.5 should be fine for most flake experimentation, shouldnāt it?
(Not blaming you in the slightest: shit happens, and I completely agreed with your conclusion. I just ended up falling into the gap left open by the āalmostā )