nix: add elegant grub2 theme package
This commit is contained in:
@@ -113,6 +113,7 @@
|
||||
codex = inputs.codex-cli-nix.packages.${prev.stdenv.hostPlatform.system}.default;
|
||||
claude-code = inputs.claude-code-nix.packages.${prev.stdenv.hostPlatform.system}.default;
|
||||
git-sync-rs = inputs.git-sync-rs.packages.${prev.stdenv.hostPlatform.system}.default;
|
||||
elegant-grub2-theme = final.callPackage ./packages/elegant-grub2-theme {};
|
||||
kef = final.callPackage ./packages/kef {};
|
||||
pykefcontrol = final.python3Packages.callPackage ./packages/pykefcontrol {};
|
||||
roborock-control = final.callPackage ./packages/roborock-control {};
|
||||
|
||||
86
nixos/packages/elegant-grub2-theme/default.nix
Normal file
86
nixos/packages/elegant-grub2-theme/default.nix
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
fetchFromGitHub,
|
||||
imagemagick,
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
theme ? "wave",
|
||||
style ? "window",
|
||||
side ? "left",
|
||||
color ? "dark",
|
||||
screenVariant ? "1080p",
|
||||
width ? null,
|
||||
height ? null,
|
||||
}: let
|
||||
customResolution = width != null && height != null;
|
||||
fontSizes = {
|
||||
"1080p" = "16";
|
||||
"2k" = "24";
|
||||
"4k" = "32";
|
||||
};
|
||||
fontSize = builtins.getAttr screenVariant fontSizes;
|
||||
themeName =
|
||||
"Elegant-${theme}-${style}-${side}-${color}"
|
||||
+ lib.optionalString customResolution "-${width}x${height}";
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "elegant-grub2-theme";
|
||||
version = "2025-03-25";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "vinceliuice";
|
||||
repo = "Elegant-grub2-themes";
|
||||
rev = "2025-03-25";
|
||||
hash = "sha256-M9k6R/rUvEpBTSnZ2PMv5piV50rGTBrcmPU4gsS7Byg=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = lib.optional customResolution imagemagick;
|
||||
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
|
||||
theme_dir="$out/share/grub/themes/${themeName}"
|
||||
mkdir -p "$theme_dir"
|
||||
|
||||
cp -a common/terminus*.pf2 "$theme_dir"/
|
||||
cp -a common/unifont-${fontSize}.pf2 "$theme_dir"/
|
||||
cp -a assets/assets-icons-${color}/icons-${color}-${screenVariant} "$theme_dir/icons"
|
||||
cp -a config/theme-${style}-${side}-${color}-${screenVariant}.txt "$theme_dir/theme.txt"
|
||||
cp -a assets/assets-other/other-${screenVariant}/select_e-${theme}-${color}.png "$theme_dir/select_e.png"
|
||||
cp -a assets/assets-other/other-${screenVariant}/select_c-${theme}-${color}.png "$theme_dir/select_c.png"
|
||||
cp -a assets/assets-other/other-${screenVariant}/select_w-${theme}-${color}.png "$theme_dir/select_w.png"
|
||||
cp -a assets/assets-other/other-${screenVariant}/Default.png "$theme_dir/logo.png"
|
||||
''
|
||||
+ lib.optionalString customResolution ''
|
||||
magick backgrounds/backgrounds-${theme}/background-${theme}-${style}-${side}-${color}.jpg \
|
||||
-resize ${width}x${height}^ \
|
||||
-gravity center \
|
||||
-extent ${width}x${height} \
|
||||
"$theme_dir/background.jpg"
|
||||
magick assets/assets-other/other-${screenVariant}/${style}-${side}.png \
|
||||
-resize x${height} \
|
||||
-background none \
|
||||
-gravity west \
|
||||
-extent ${width}x${height} \
|
||||
"$theme_dir/info.png"
|
||||
''
|
||||
+ lib.optionalString (!customResolution) ''
|
||||
cp -a backgrounds/backgrounds-${theme}/background-${theme}-${style}-${side}-${color}.jpg "$theme_dir/background.jpg"
|
||||
cp -a assets/assets-other/other-${screenVariant}/${style}-${side}.png "$theme_dir/info.png"
|
||||
''
|
||||
+ ''
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
passthru = {
|
||||
inherit themeName;
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Elegant wave GRUB2 theme";
|
||||
homepage = "https://github.com/vinceliuice/Elegant-grub2-themes";
|
||||
license = lib.licenses.gpl3Only;
|
||||
maintainers = [];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user