eglexternalplatform: add update script and setup hook, add maintainer

This commit is contained in:
ccicnce113424
2026-03-25 03:06:09 +08:00
parent c7dfcad894
commit 809f525f6d
2 changed files with 62 additions and 3 deletions
@@ -4,6 +4,9 @@
fetchFromGitHub,
meson,
ninja,
buildPackages,
replaceVars,
nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
@@ -11,9 +14,9 @@ stdenv.mkDerivation (finalAttrs: {
version = "1.2.1";
src = fetchFromGitHub {
owner = "Nvidia";
owner = "NVIDIA";
repo = "eglexternalplatform";
rev = finalAttrs.version;
tag = finalAttrs.version;
hash = "sha256-tDKh1oSnOSG/XztHHYCwg1tDB7M6olOtJ8te+uan9ko=";
};
@@ -22,11 +25,24 @@ stdenv.mkDerivation (finalAttrs: {
ninja
];
setupHook = replaceVars ./setup-hook.sh {
jq = lib.getExe buildPackages.jq;
sponge = lib.getExe' buildPackages.moreutils "sponge";
};
strictDeps = true;
__structuredAttrs = true;
passthru.updateScript = nix-update-script { extraArgs = [ "--use-github-releases" ]; };
meta = {
description = "EGL External Platform interface";
homepage = "https://github.com/NVIDIA/eglexternalplatform";
license = lib.licenses.mit;
platforms = lib.platforms.linux ++ lib.platforms.freebsd;
maintainers = with lib.maintainers; [ hedning ];
maintainers = with lib.maintainers; [
hedning
ccicnce113424
];
};
})
@@ -0,0 +1,43 @@
# shellcheck shell=bash
absolutizeIcdLibraryPath() {
local jsonFile="$1"
local libPath="$2"
if [[ -z "$jsonFile" || -z "$libPath" ]]; then
nixErrorLog "absolutizeIcdLibraryPath: expected <json-file> <library-prefix>"
return 1
fi
if [[ ! -f "$jsonFile" ]]; then
nixErrorLog "absolutizeIcdLibraryPath: JSON file not found: $jsonFile"
return 1
fi
@jq@ --arg lib "$libPath" \
'.ICD.library_path |= $lib + .' \
"$jsonFile" | @sponge@ "$jsonFile"
}
fixupEglExternalPlatformIcdJsonHook() {
case "${absolutizeEglExternalPlatformIcdJson-}" in
1|true|yes) ;;
*) return 0 ;;
esac
local jsonDir="$prefix/share/egl/egl_external_platform.d"
if [[ ! -d "$jsonDir" ]]; then
return 0
fi
local f
for f in "$jsonDir"/*.json; do
if [[ ! -e "$f" ]]; then
continue
fi
absolutizeIcdLibraryPath "$f" "$prefix/lib/"
done
}
fixupOutputHooks+=(fixupEglExternalPlatformIcdJsonHook)