How can I use the stable channel and use an option from unstable just for one package?

Hi, I am a beginner of NixOS, using the stable 23.05 channel, installed inside QEMU virtual machine.
I have been playing with it for just a few days.

I use grub2, and I want to set the GRUB_TIMEOUT_STYLE=hidden.
I noticed that there is a boot.loader.grub.timeoutStyle option in the unstable branch which is exactly what I need.

I was expected to install the unstable grub2 following the guide in ( Installing only a single package from `unstable` - #2 by dalto ), to add:

  unstable = import <nixos-unstable> {}; };
in {

at the beginning of the configuration.nix and put unstable.grub2 in environment.systemPackages = with pkgs; [ ]; would work.
However the timeoutStyle option still did not exist.

Is there any way to make it work in 23.05 channel?
Thanks for your help!

I found out that it be achieved by this:

disabledModules = [
imports = [

However the result is not what I want, holding SHIFT cannot bring back the grub menu.
I will figure it out later.

1 Like

now I use boot.loader.timeout = 1; instead.

Mixing modules from stable and unstable can be rather risky: the unstable module can depend on changes made in other modules that won’t be present in the stable version. Sometimes you might get lucky and it will still work if things haven’t diverged that much, but you never know.


Thanks for your advice.
I tested another unstable module and it breaks exactly for the reason you mentioned :joy: