gtklock: add module compatibility check helper

This commit is contained in:
aleksana 2024-10-22 15:09:48 +08:00
parent 25e67ab7fd
commit 48c03f11aa

View File

@ -10,6 +10,7 @@
gtk3,
pam,
gtk-session-lock,
runCommand,
}:
stdenv.mkDerivation (finalAttrs: {
@ -40,6 +41,21 @@ stdenv.mkDerivation (finalAttrs: {
strictDeps = true;
passthru.testModule =
module:
runCommand "${module.name}-test.sh" { } ''
MODULE_PATH=$(find ${module}/lib/gtklock -maxdepth 1 -name '*.so')
echo -e "[main]\nmodules=''${MODULE_PATH}" >./config.ini
${finalAttrs.finalPackage}/bin/gtklock --config ./config.ini >./log 2>&1 || true
if grep incompatible ./log; then
echo "${module.name} is incompatible with current ${finalAttrs.finalPackage.name}!"
exit 1
else
echo "Successfully tested ${module.name} against ${finalAttrs.finalPackage.name}."
fi
touch $out
'';
meta = {
description = "GTK-based lockscreen for Wayland";
longDescription = ''