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
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?