mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
nixos: Add support for scalable fonts in Grub menus (#26227)
The default font is unreadably small on some hidpi displays. This makes it possible to specify a TrueType or OpenType font at any point size, and it will automatically be converted to the format the Grub uses.
This commit is contained in:
parent
1fe951816c
commit
700e22f7bf
2 changed files with 34 additions and 2 deletions
|
@ -64,11 +64,21 @@ let
|
|||
)) + ":" + (makeSearchPathOutput "bin" "sbin" [
|
||||
pkgs.mdadm pkgs.utillinux
|
||||
]);
|
||||
font = if lib.last (lib.splitString "." cfg.font) == "pf2"
|
||||
then cfg.font
|
||||
else "${convertedFont}";
|
||||
});
|
||||
|
||||
bootDeviceCounters = fold (device: attr: attr // { "${device}" = (attr."${device}" or 0) + 1; }) {}
|
||||
(concatMap (args: args.devices) cfg.mirroredBoots);
|
||||
|
||||
convertedFont = (pkgs.runCommand "grub-font-converted.pf2" {}
|
||||
(builtins.concatStringsSep " "
|
||||
([ "${realGrub}/bin/grub-mkfont"
|
||||
cfg.font
|
||||
"--output" "$out"
|
||||
] ++ (optional (cfg.fontSize!=null) "--size ${toString cfg.fontSize}")))
|
||||
);
|
||||
in
|
||||
|
||||
{
|
||||
|
@ -276,7 +286,7 @@ in
|
|||
extraInitrd = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
example = "/boot/extra_initrafms.gz";
|
||||
example = "/boot/extra_initramfs.gz";
|
||||
description = ''
|
||||
The path to a second initramfs to be supplied to the kernel.
|
||||
This ramfs will not be copied to the store, so that it can
|
||||
|
@ -305,6 +315,24 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
font = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = "${realGrub}/share/grub/unicode.pf2";
|
||||
description = ''
|
||||
Path to a TrueType, OpenType, or pf2 font to be used by Grub.
|
||||
'';
|
||||
};
|
||||
|
||||
fontSize = mkOption {
|
||||
type = types.nullOr types.int;
|
||||
example = literalExample 16;
|
||||
default = null;
|
||||
description = ''
|
||||
Font size for the grub menu. Ignored unless <literal>font</literal>
|
||||
is set to a ttf or otf font.
|
||||
'';
|
||||
};
|
||||
|
||||
gfxmodeEfi = mkOption {
|
||||
default = "auto";
|
||||
example = "1024x768";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue