Added footer and enable option

This commit is contained in:
madisetti 2022-02-21 11:59:04 -05:00
parent 2fd6eb9b66
commit 4f3b99cdf3
No known key found for this signature in database
GPG Key ID: 9080F46A6E933A9D

View File

@ -34,6 +34,13 @@
--screen ${cfg.screen} \
--theme ${cfg.theme} \
--icon ${cfg.icon};
if [ -f ${cfg.splashImage} ]; then
cp ${cfg.splashImage} $out/grub/themes/${cfg.theme}/background.jpg;
fi;
if [ ${pkgs.lib.trivial.boolToString cfg.footer} == "false" ]; then
sed -i ':again;$!N;$!b again; s/\+ image {[^}]*}//g' $out/grub/themes/${cfg.theme}/theme.txt;
fi;
'';
};
resolution = resolutions."${cfg.screen}";
@ -41,6 +48,14 @@
rec {
options = {
boot.loader.grub2-theme = {
enable = mkOption {
default = true;
example = true;
type = types.bool;
description = ''
Enable grub2 theming
'';
};
theme = mkOption {
default = "tela";
example = "tela";
@ -68,14 +83,22 @@
splashImage = mkOption {
default = "";
example = "/my/path/background.jpg";
type = types.string;
type = types.path;
description = ''
The path of the image to use for background (must be jpg).
'';
};
footer = mkOption {
default = true;
example = true;
type = types.bool;
description = ''
Whether to include the image footer.
'';
};
};
config = mkMerge [{
};
config = mkIf cfg.enable (mkMerge [{
environment.systemPackages = [
grub2-theme
];
@ -84,8 +107,13 @@
splashImage = "${grub2-theme}/grub/themes/${cfg.theme}/background.jpg";
gfxmodeEfi = "${resolution},auto";
gfxmodeBios = "${resolution},auto";
extraConfig = ''
insmod gfxterm
insmod png
set icondir=($root)/theme/icons
'';
};
}];
}]);
};
};
}