From 48c03f11aae9dbb9858092053d3e78922754ed4a Mon Sep 17 00:00:00 2001 From: aleksana Date: Tue, 22 Oct 2024 15:09:48 +0800 Subject: [PATCH] gtklock: add module compatibility check helper --- pkgs/by-name/gt/gtklock/package.nix | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/pkgs/by-name/gt/gtklock/package.nix b/pkgs/by-name/gt/gtklock/package.nix index e4a3853f78d8..ff3369c1ebbf 100644 --- a/pkgs/by-name/gt/gtklock/package.nix +++ b/pkgs/by-name/gt/gtklock/package.nix @@ -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 = ''