From b96059664c97911716edcd79df6149f558f4f451 Mon Sep 17 00:00:00 2001 From: Daniel Thwaites Date: Sat, 17 Sep 2022 14:05:20 +0100 Subject: [PATCH] Implement `useImage` option for GRUB :sparkles: Using Plymouth as the default value to retain backwards compatibility. --- modules/grub.nix | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/grub.nix b/modules/grub.nix index e16537e..6c81a11 100644 --- a/modules/grub.nix +++ b/modules/grub.nix @@ -23,8 +23,19 @@ let ''; in { - options.stylix.targets.grub.enable = - config.lib.stylix.mkEnableTarget "GRUB" true; + options.stylix.targets.grub = { + enable = config.lib.stylix.mkEnableTarget "GRUB" true; + + useImage = lib.mkOption { + description = '' + Whether to use your wallpaper image for the GRUB background. + If this is disabled, a plain color will be used instead. + ''; + type = lib.types.bool; + default = config.stylix.targets.plymouth.enable; + defaultText = lib.literalExpression "stylix.targets.plymouth.enable"; + }; + }; config.boot.loader.grub = lib.mkIf config.stylix.targets.grub.enable { backgroundColor = base00; @@ -88,7 +99,7 @@ in { mkdir $out cp $themeTxtPath $out/theme.txt - ${if config.boot.plymouth.enable + ${if config.stylix.targets.grub.useImage # Make sure the background image is .png by asking to convert it then "${pkgs.imagemagick}/bin/convert ${config.stylix.image} png32:$out/background.png"