[Nix-dev] Regarding extra GRUB options in Configuration.nix

Kirill Elagin kirelagin at gmail.com
Wed May 28 10:11:47 CEST 2014


If you like this shift-style menu triggering, then yes, that's what I mean.
If you want the timeout + hidden timeout as in default grub, then use the
snippet above.

`grub.timeout` will have no effect at all as it emits `set timeout = ...`
_before_ `extraConfig` is
appended, so `set timeout = ...` in your `extraConfig` overrides it
(`timeout` in `grub.cfg` is just a variable).


--
Кирилл Елагин


On Wed, May 28, 2014 at 4:06 AM, Roger Qiu <roger.qiu at polycademy.com> wrote:

>  Thanks for the information!
>
> Just a clarification do you mean to do this as work around?
>
> boot.loader.grub.extraConfig = ''
>
> if keystatus --shift ; then
>     set timeout=-1
> else
>     set timeout=0
> fi
> '';
>
> I currently have boot.loader.grub.timeout = 0; Will this directive need to
> change?
>
> Thanks,
> Roger
>
>
> On 28/05/2014 3:29 AM, Kirill Elagin wrote:
>
>  Well, it looks like I should start with basics of grub.
>
>  Grub has a configuration file, `grub.cfg`. There is no such thing as
> “hidden timeout” in terms of grub's configuration file.
>
> Also they ship scripts that generate this configuration from another
> configuration, supposedly, a more user-friendly one.
> That's actually what you edit in `/etc/default/grub`. By the way, the
> scripts that source this file and generate `grub.cfg`
> are in `/etc/grub.d/` so you can check them out if you are interested. The
> relevant part is `make_timeout` function in `00_header`.
> I should note that I never trusted those generating scripts, because they
> produce tons of useless code and I prefer to write
> `grub.cfg` myself (kinda old-school, yeah!).
>
> Now, NixOS, obviously doesn't use those scripts and generates `grub.cfg`
> for you. So, the thing is, there is no way
> to configure “hidden timeout” which is not cool, and I'll definitely put
> this on my list of my future contributions to NixOS.
> But for now you can simulate this by putting something like:
>
> boot.loader.grub.extraConfig = ''
>     if sleep --interruptible 5 ; then
>         set timeout=10
>     fi
> '';
>
> (Not tested, just guessing.)
> (Where 5 is GRUB_HIDDEN_TIMEOUT and 10 is GRUB_TIMEOUT.)
>
> This way you'll get the same behaviour as grub's upstream generator
> scripts give you.
>
> Personally I normally use this in my `grub.cfg` instead:
>
> if keystatus --shift ; then
>     set timeout=-1
> else
>     set timeout=0
> fi
>
> This will normally boot immediately without displaying the menu or waiting
> for something, _unless_ you are holding
> shift when booting. If you are holding shift, it will display the menu
> without timeout.
>
>
>
>  --
> Кирилл Елагин
>
>
> On Tue, May 27, 2014 at 11:53 AM, Roger Qiu <roger.qiu at polycademy.com>wrote:
>
>>  Hello,
>>
>> In a configuration.nix, where would you be able to set GRUB options such
>> as:
>>
>> GRUB_HIDDEN_TIMEOUT=0
>> GRUB_HIDDEN_TIMEOUT_QUIET=true
>>
>> The normal boot.loader.grub does not seem to have these functions?
>>
>> Thanks,
>> Roger
>>
>> _______________________________________________
>> nix-dev mailing list
>> nix-dev at lists.science.uu.nl
>> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20140528/bd7d7d17/attachment.html 


More information about the nix-dev mailing list