mirror of
https://github.com/vinceliuice/grub2-themes.git
synced 2024-12-25 07:25:35 +01:00
Update flake.nix to allow customised resolution for NixOS
This commit is contained in:
parent
e3a5ea51ae
commit
7cff52a245
42
flake.nix
42
flake.nix
@ -26,7 +26,7 @@
|
|||||||
"2k" = "2560x1440";
|
"2k" = "2560x1440";
|
||||||
"4k" = "3840x2160";
|
"4k" = "3840x2160";
|
||||||
"ultrawide2k" = "3440x1440";
|
"ultrawide2k" = "3440x1440";
|
||||||
};
|
} // (if cfg.customResolution != null then { "custom" = cfg.customResolution; } else {});
|
||||||
grub2-theme = pkgs.stdenv.mkDerivation {
|
grub2-theme = pkgs.stdenv.mkDerivation {
|
||||||
name = "grub2-theme";
|
name = "grub2-theme";
|
||||||
src = "${self}";
|
src = "${self}";
|
||||||
@ -61,7 +61,9 @@
|
|||||||
fi;
|
fi;
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
resolution = resolutions."${cfg.screen}";
|
resolution = if cfg.customResolution != null
|
||||||
|
then cfg.customResolution
|
||||||
|
else resolutions."${cfg.screen}";
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
options = {
|
options = {
|
||||||
@ -93,9 +95,17 @@
|
|||||||
screen = mkOption {
|
screen = mkOption {
|
||||||
default = "1080p";
|
default = "1080p";
|
||||||
example = "1080p";
|
example = "1080p";
|
||||||
type = types.enum [ "1080p" "2k" "4k" "ultrawide" "ultrawide2k" ];
|
type = types.enum ([ "1080p" "2k" "4k" "ultrawide" "ultrawide2k" ] ++ (if cfg.customResolution != null then [ "custom" ] else []));
|
||||||
description = ''
|
description = ''
|
||||||
The screen resolution to use for grub2.
|
The screen resolution to use for grub2. Use "custom" if you've set a customResolution.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
customResolution = mkOption {
|
||||||
|
default = null;
|
||||||
|
example = "1600x900";
|
||||||
|
type = types.nullOr (types.strMatching "[0-9]+x[0-9]+");
|
||||||
|
description = ''
|
||||||
|
Custom resolution for grub2 theme. Should be in the format "WIDTHxHEIGHT".
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
splashImage = mkOption {
|
splashImage = mkOption {
|
||||||
@ -138,19 +148,17 @@
|
|||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
grub2-theme
|
grub2-theme
|
||||||
];
|
];
|
||||||
boot.loader.grub =
|
boot.loader.grub = {
|
||||||
{
|
theme = "${grub2-theme}/grub/themes/${cfg.theme}";
|
||||||
theme = "${grub2-theme}/grub/themes/${cfg.theme}";
|
splashImage = "${grub2-theme}/grub/themes/${cfg.theme}/background.jpg";
|
||||||
splashImage =
|
gfxmodeEfi = "${resolution},auto";
|
||||||
"${grub2-theme}/grub/themes/${cfg.theme}/background.jpg";
|
gfxmodeBios = "${resolution},auto";
|
||||||
gfxmodeEfi = "${resolution},auto";
|
extraConfig = ''
|
||||||
gfxmodeBios = "${resolution},auto";
|
insmod gfxterm
|
||||||
extraConfig = ''
|
insmod png
|
||||||
insmod gfxterm
|
set icondir=($root)/theme/icons
|
||||||
insmod png
|
'';
|
||||||
set icondir=($root)/theme/icons
|
};
|
||||||
'';
|
|
||||||
};
|
|
||||||
}]);
|
}]);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user