Merge pull request #162 from thomassdk/FixNixOSSupport

Make splashImage option a `nullOr` type
This commit is contained in:
Vince 2022-03-28 00:26:11 +08:00 committed by GitHub
commit fa74d1b6af
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@
nixosModule = { config, ... }:
let
cfg = config.boot.loader.grub2-theme;
splashImage = if cfg.splashImage == null then "" else cfg.splashImage;
resolutions = {
"1080p" = "1920x1080";
"ultrawide" = "2560x1080";
@ -35,8 +36,8 @@
--theme ${cfg.theme} \
--icon ${cfg.icon};
if [ -f ${cfg.splashImage} ]; then
cp ${cfg.splashImage} $out/grub/themes/${cfg.theme}/background.jpg;
if [ -n "${splashImage}" ]; then
cp ${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;
@ -81,9 +82,9 @@
'';
};
splashImage = mkOption {
default = "";
default = null;
example = "/my/path/background.jpg";
type = types.path;
type = types.nullOr types.path;
description = ''
The path of the image to use for background (must be jpg).
'';