From 4b3a35615004c84e1661b94ad6b0eb460eaf8fe3 Mon Sep 17 00:00:00 2001 From: John Titor <50095635+JohnRTitor@users.noreply.github.com> Date: Sat, 24 Oct 2026 19:17:16 +0530 Subject: [PATCH] nixos/limine: add graphicalTerminal.enable option Setting this to false allows forcing text mode. --- .../boot/loader/limine/limine-install.py | 64 ++++++++++--------- .../system/boot/loader/limine/limine.nix | 8 +++ 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/nixos/modules/system/boot/loader/limine/limine-install.py b/nixos/modules/system/boot/loader/limine/limine-install.py index 3191736b3ab0..9206905d0f35 100644 --- a/nixos/modules/system/boot/loader/limine/limine-install.py +++ b/nixos/modules/system/boot/loader/limine/limine-install.py @@ -517,6 +517,7 @@ def install_bootloader() -> None: timeout = config("timeout") editor_enabled = bool_to_yes_no(config("enableEditor")) hash_mismatch_panic = bool_to_yes_no(config("panicOnChecksumMismatch")) + graphics = bool_to_yes_no(config("style", "graphicalTerminal", "enable")) last_gen = get_gens()[-1] last_gen_json = json.load( @@ -529,7 +530,7 @@ def install_bootloader() -> None: timeout: {timeout} editor_enabled: {editor_enabled} hash_mismatch_panic: {hash_mismatch_panic} - graphics: yes + graphics: {graphics} default_entry: {3 if len(last_gen_boot_spec.specialisations.items()) > 0 else 2} """) @@ -559,36 +560,37 @@ def install_bootloader() -> None: config_file += option_from_config( "interface_help_hidden", ["style", "interface", "helpHidden"] ) - config_file += option_from_config( - "term_font_scale", ["style", "graphicalTerminal", "font", "scale"] - ) - config_file += option_from_config( - "term_font_spacing", ["style", "graphicalTerminal", "font", "spacing"] - ) - config_file += option_from_config( - "term_palette", ["style", "graphicalTerminal", "palette"] - ) - config_file += option_from_config( - "term_palette_bright", ["style", "graphicalTerminal", "brightPalette"] - ) - config_file += option_from_config( - "term_foreground", ["style", "graphicalTerminal", "foreground"] - ) - config_file += option_from_config( - "term_background", ["style", "graphicalTerminal", "background"] - ) - config_file += option_from_config( - "term_foreground_bright", ["style", "graphicalTerminal", "brightForeground"] - ) - config_file += option_from_config( - "term_background_bright", ["style", "graphicalTerminal", "brightBackground"] - ) - config_file += option_from_config( - "term_margin", ["style", "graphicalTerminal", "margin"] - ) - config_file += option_from_config( - "term_margin_gradient", ["style", "graphicalTerminal", "marginGradient"] - ) + if config("style", "graphicalTerminal", "enable"): + config_file += option_from_config( + "term_font_scale", ["style", "graphicalTerminal", "font", "scale"] + ) + config_file += option_from_config( + "term_font_spacing", ["style", "graphicalTerminal", "font", "spacing"] + ) + config_file += option_from_config( + "term_palette", ["style", "graphicalTerminal", "palette"] + ) + config_file += option_from_config( + "term_palette_bright", ["style", "graphicalTerminal", "brightPalette"] + ) + config_file += option_from_config( + "term_foreground", ["style", "graphicalTerminal", "foreground"] + ) + config_file += option_from_config( + "term_background", ["style", "graphicalTerminal", "background"] + ) + config_file += option_from_config( + "term_foreground_bright", ["style", "graphicalTerminal", "brightForeground"] + ) + config_file += option_from_config( + "term_background_bright", ["style", "graphicalTerminal", "brightBackground"] + ) + config_file += option_from_config( + "term_margin", ["style", "graphicalTerminal", "margin"] + ) + config_file += option_from_config( + "term_margin_gradient", ["style", "graphicalTerminal", "marginGradient"] + ) config_file += textwrap.dedent(f""" # {config("distroName")} boot entries start here diff --git a/nixos/modules/system/boot/loader/limine/limine.nix b/nixos/modules/system/boot/loader/limine/limine.nix index 4be3063674fe..9a7dea452d81 100644 --- a/nixos/modules/system/boot/loader/limine/limine.nix +++ b/nixos/modules/system/boot/loader/limine/limine.nix @@ -338,6 +338,14 @@ in }; }; graphicalTerminal = { + enable = lib.mkEnableOption null // { + default = true; + example = false; + description = '' + Whether to enable the graphical terminal. Set it to false to force text mode. + ''; + }; + font = { scale = lib.mkOption { default = null;