sanjuuni: add run-on-nixos-artwork test (#314690)

This commit is contained in:
Peder Bergebakken Sundt 2024-09-17 01:08:40 +02:00 committed by GitHub
commit 0657c4ba88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 0 deletions

View File

@ -7,6 +7,7 @@
poco,
ocl-icd,
opencl-clhpp,
callPackage,
}:
stdenv.mkDerivation rec {
@ -37,6 +38,10 @@ stdenv.mkDerivation rec {
runHook postInstall
'';
passthru.tests = {
run-on-nixos-artwork = callPackage ./tests/run-on-nixos-artwork.nix { };
};
meta = with lib; {
homepage = "https://github.com/MCJack123/sanjuuni";
description = "Command-line tool that converts images and videos into a format that can be displayed in ComputerCraft";

View File

@ -0,0 +1,34 @@
{
runCommand,
sanjuuni,
nixos-artwork,
lua5_2,
}:
let
makeCommand = derivation: baseFilename: ''
echo "sanjuuni-test-run-on-nixos-artwork: Running Sanjuuni on ${derivation}/share/backgrounds/nixos/${baseFilename}.png"
sanjuuni --lua --disable-opencl \
--input ${derivation}/share/backgrounds/nixos/${baseFilename}.png \
--output $out/${baseFilename}.lua
echo "sanjuuni-test-run-on-nixos-artwork: Checking syntax on $out/${baseFilename}.lua"
lua -e "loadfile(\"$out/${baseFilename}.lua\")"
'';
in
runCommand "sanjuuni-test-run-on-nixos-artwork"
{
nativeBuildInputs = [
sanjuuni
lua5_2
nixos-artwork.wallpapers.simple-blue
nixos-artwork.wallpapers.simple-red
nixos-artwork.wallpapers.simple-dark-gray
nixos-artwork.wallpapers.stripes
];
}
''
mkdir -p $out
${makeCommand nixos-artwork.wallpapers.simple-blue "nix-wallpaper-simple-blue"}
${makeCommand nixos-artwork.wallpapers.simple-red "nix-wallpaper-simple-red"}
${makeCommand nixos-artwork.wallpapers.simple-dark-gray "nix-wallpaper-simple-dark-gray"}
${makeCommand nixos-artwork.wallpapers.stripes "nix-wallpaper-stripes"}
''