Add an extension point for Lua scripts, then you could build the scripts as a flatpak extension including the binaries some scripts use.