init
s s s s s s s
This commit is contained in:
commit
8a627ef8b0
43
flake.lock
generated
Normal file
43
flake.lock
generated
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nix-systems": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1746397377,
|
||||
"narHash": "sha256-5oLdRa3vWSRbuqPIFFmQBGGUqaYZBxX+GGtN9f/n4lU=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "ed30f8aba41605e3ab46421e3dcb4510ec560ff8",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nix-systems": "nix-systems",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
25
flake.nix
Normal file
25
flake.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
nix-systems.url = "github:nix-systems/default-linux";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self,
|
||||
nixpkgs,
|
||||
nix-systems,
|
||||
...
|
||||
}:
|
||||
let
|
||||
forAllSystems = (
|
||||
function:
|
||||
nixpkgs.lib.genAttrs (import nix-systems) (system: function nixpkgs.legacyPackages.${system})
|
||||
);
|
||||
in
|
||||
{
|
||||
packages = forAllSystems (pkgs: {
|
||||
default = pkgs.callPackage ./package.nix { };
|
||||
});
|
||||
};
|
||||
}
|
65
package.nix
Normal file
65
package.nix
Normal file
@ -0,0 +1,65 @@
|
||||
{
|
||||
stdenvNoCC,
|
||||
fetchFromGitea,
|
||||
lib,
|
||||
selectedTheme ? "starship",
|
||||
screenNumber ? 0,
|
||||
}:
|
||||
let
|
||||
themeDetails = import ./themes.nix;
|
||||
# validThemes = builtins.attrNames themeDetails;
|
||||
# themeName = lib.checkListOfEnum "plymouth theme" validThemes selectedTheme;
|
||||
themeName = selectedTheme;
|
||||
theme = themeDetails.${themeName};
|
||||
in
|
||||
stdenvNoCC.mkDerivation {
|
||||
pname = "hudcore-plymouth";
|
||||
version = "${themeName}";
|
||||
|
||||
src = fetchFromGitea {
|
||||
domain = "git.atagen.co";
|
||||
owner = "atagen";
|
||||
repo = "hudcore-plymouth";
|
||||
rev = theme.rev;
|
||||
hash = theme.hash;
|
||||
};
|
||||
|
||||
installPhase =
|
||||
let
|
||||
templateScript = ./template.script;
|
||||
templatePlymouth = ./template.plymouth;
|
||||
themeScript = "${themeName}.script";
|
||||
themePlymouth = "${themeName}.plymouth";
|
||||
in
|
||||
''
|
||||
cp ${templateScript} ${themeScript}
|
||||
sed -i 's/%SCREEN_NUMBER%/${toString screenNumber}/g' ${themeScript}
|
||||
sed -i 's/%FRAME_COUNT%/${toString theme.frameCount}/g' ${themeScript}
|
||||
|
||||
cp ${templatePlymouth} ${themePlymouth}
|
||||
sed -i 's/%NAME%/${themeName}/g' ${themePlymouth}
|
||||
|
||||
mkdir -p $out/share/plymouth/themes/${themeName}
|
||||
cp -r * $out/share/plymouth/themes/${themeName}
|
||||
find $out/share/plymouth/themes/ -name \*.plymouth -exec sed -i "s@\/usr\/@$out\/@" {} \;
|
||||
'';
|
||||
|
||||
passthru.updateScript = { };
|
||||
|
||||
meta = {
|
||||
description = "Fantasy HUD Plymouth themes";
|
||||
longDescription = ''
|
||||
A set of mostly HUD-inspired plymouth boot screens.
|
||||
Default is `starship`.
|
||||
Override `selectedTheme` in order to pick a different one.
|
||||
Currently available:
|
||||
`nixdrop`
|
||||
`starship`
|
||||
`containment`
|
||||
'';
|
||||
homepage = "https://git.atagen.co/atagen/hudcore-plymouth";
|
||||
license = lib.licenses.gpl3;
|
||||
platforms = lib.platforms.linux;
|
||||
maintainers = [ lib.maintainers.atagen ];
|
||||
};
|
||||
}
|
8
template.plymouth
Normal file
8
template.plymouth
Normal file
@ -0,0 +1,8 @@
|
||||
[Plymouth Theme]
|
||||
Name=%NAME%
|
||||
Description=A theme from the atagen/hudcore-plymouth pack.
|
||||
ModuleName=script
|
||||
|
||||
[script]
|
||||
ImageDir=/usr/share/plymouth/themes/%NAME%
|
||||
ScriptFile=/usr/share/plymouth/themes/%NAME%/%NAME%.script
|
102
template.script
Normal file
102
template.script
Normal file
@ -0,0 +1,102 @@
|
||||
// based on work by Aditya Shakya (adi1090x@gmail.com)
|
||||
bullets = null;
|
||||
prompt = null;
|
||||
message = null;
|
||||
question = null;
|
||||
answer = null;
|
||||
|
||||
bullet.image = Image.Text("*", 1, 1, 1)
|
||||
|
||||
state.time = 0.0;
|
||||
state.status = "play";
|
||||
|
||||
screen.w = Window.GetWidth(%SCREEN_NUMBER%);
|
||||
screen.h = Window.GetHeight(%SCREEN_NUMBER%);
|
||||
// why can't we use screen.w ? wtf
|
||||
screen.hw = Window.GetWidth(%SCREEN_NUMBER%) / 2;
|
||||
screen.hh = Window.GetHeight(%SCREEN_NUMBER%) / 2;
|
||||
|
||||
for (i = 0; i < %FRAME_COUNT%; i++)
|
||||
{
|
||||
images.img[i] = Image(i + ".png");
|
||||
}
|
||||
|
||||
w = images.img[0].GetWidth()
|
||||
h = images.img[0].GetHeight()
|
||||
hw = images.img[0].GetWidth() / 2
|
||||
hh = images.img[0].GetHeight() / 2
|
||||
|
||||
draw = Sprite();
|
||||
draw.SetX(Window.GetX() + (screen.hw - hw));
|
||||
draw.SetY(Window.GetY() + (screen.hh - hh));
|
||||
|
||||
|
||||
cur_frame = 0;
|
||||
|
||||
fun refresh ()
|
||||
{
|
||||
draw.SetImage(images.img[cur_frame]);
|
||||
cur_frame = (cur_frame + 1) % %FRAME_COUNT%;
|
||||
}
|
||||
Plymouth.SetRefreshFunction(refresh);
|
||||
|
||||
fun DisplayQuestionCallback(prompt, entry)
|
||||
{
|
||||
question = null;
|
||||
answer = null;
|
||||
|
||||
if (entry == "")
|
||||
entry = "<answer>";
|
||||
|
||||
question.image = Image.Text(prompt, 1, 1, 1);
|
||||
question.sprite = Sprite(question.image);
|
||||
question.sprite.SetX(screen.half.w - question.image.GetWidth() / 2);
|
||||
question.sprite.SetY(screen.h - 4 * question.image.GetHeight());
|
||||
|
||||
answer.image = Image.Text(entry, 1, 1, 1);
|
||||
answer.sprite = Sprite(answer.image);
|
||||
answer.sprite.SetX(screen.half.w - answer.image.GetWidth() / 2);
|
||||
answer.sprite.SetY(screen.h - 2 * answer.image.GetHeight());
|
||||
}
|
||||
Plymouth.SetDisplayQuestionFunction(DisplayQuestionCallback);
|
||||
|
||||
|
||||
fun DisplayPasswordCallback(nil, bulletCount)
|
||||
{
|
||||
state.status = "pause";
|
||||
totalWidth = bulletCount * bullet.image.GetWidth();
|
||||
startPos = screen.half.w - totalWidth / 2;
|
||||
|
||||
prompt.image = Image.Text("Enter Password", 1, 1, 1);
|
||||
prompt.sprite = Sprite(prompt.image);
|
||||
prompt.sprite.SetX(screen.half.w - prompt.image.GetWidth() / 2);
|
||||
prompt.sprite.SetY(screen.h - 4 * prompt.image.GetHeight());
|
||||
|
||||
// Clear all bullets (user might hit backspace)
|
||||
bullets = null;
|
||||
for (i = 0; i < bulletCount; i++) {
|
||||
bullets[i].sprite = Sprite(bullet.image);
|
||||
bullets[i].sprite.SetX(startPos + i * bullet.image.GetWidth());
|
||||
bullets[i].sprite.SetY(screen.h - 2 * bullet.image.GetHeight());
|
||||
}
|
||||
}
|
||||
Plymouth.SetDisplayPasswordFunction(DisplayPasswordCallback);
|
||||
|
||||
fun DisplayNormalCallback()
|
||||
{
|
||||
state.status = "play";
|
||||
bullets = null;
|
||||
prompt = null;
|
||||
message = null;
|
||||
question = null;
|
||||
answer = null;
|
||||
}
|
||||
Plymouth.SetDisplayNormalFunction(DisplayNormalCallback);
|
||||
|
||||
fun MessageCallback(text)
|
||||
{
|
||||
message.image = Image.Text(text, 1, 1, 1);
|
||||
message.sprite = Sprite(message.image);
|
||||
message.sprite.SetPosition(screen.half.w - message.image.GetWidth() / 2, message.image.GetHeight());
|
||||
}
|
||||
Plymouth.SetMessageFunction(MessageCallback);
|
7
themes.nix
Normal file
7
themes.nix
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
starship = {
|
||||
frameCount = 480;
|
||||
rev = "9347219f3dd5c1641b5a981b366290d946fdd777";
|
||||
hash = "sha256-3IhfX1XJE4lvNMjQrzscTww+xK6vjH1OOjb0JT3+AfY=";
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user