nixos/kelder: Add custom boot splash

This commit is contained in:
Jack O'Sullivan 2023-05-28 13:45:27 +01:00
parent 3a5679a76d
commit 1f0c3c4160
5 changed files with 55 additions and 1 deletions

View File

@ -1,6 +1,20 @@
{ pkgs, ... }: {
{ lib, pkgs, ... }:
let
plymouth-kelder = pkgs.runCommand "plymouth-kelder" {} ''
target="$out"/share/plymouth/themes/kelder
mkdir -p "$target"
substituteAll ${./plymouth/kelder.plymouth} "$target"/kelder.plymouth
cp ${./plymouth/kelder.script} "$target"/kelder.script
cp ${./plymouth/kelder.png} "$target"/kelder.png
cp ${./plymouth/bridge.png} "$target"/bridge.png
'';
in
{
boot.plymouth = {
enable = true;
themePackages = [ plymouth-kelder ];
theme = "kelder";
};
systemd.services = {

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -0,0 +1,9 @@
[Plymouth Theme]
Name=kelder
Description=kontent
Comment=it's epic
ModuleName=script
[script]
ImageDir=@out@/share/plymouth/themes/kelder
ScriptFile=@out@/share/plymouth/themes/kelder/kelder.script

Binary file not shown.

After

Width:  |  Height:  |  Size: 310 KiB

View File

@ -0,0 +1,31 @@
fps = 50;
w = Window.GetWidth();
h = Window.GetHeight();
debug_sprite = Sprite();
fun debug(text) {
debug_sprite.SetImage(Image.Text(text, 0, 0, 0));
debug_sprite.SetPosition(0, 0, 1);
}
kelder = Image("kelder.png").Scale(w, h);
kelder_s = Sprite(kelder);
bridge = Image("bridge.png");
bridge_s = Sprite();
bridge_s.SetX((w / 2) - (bridge.GetWidth() / 2));
bridge_s.SetY((h / 2) - (bridge.GetHeight() / 2));
bridge_s.SetZ(10);
bridge_s.SetImage(bridge);
frame = 0;
fun refresh_callback() {
time = frame / fps;
# loop over 1 seconds
t = (time % 1) / 1;
bridge_s.SetImage(bridge.Rotate(t * 1.5 * (2 * Math.Pi)));
frame++;
}
Plymouth.SetRefreshFunction(refresh_callback);