cargo-tauri: gstreamer plugin for asset protocol
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
fetchFromGitHub,
|
||||
pkg-config,
|
||||
gst_all_1,
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "tauri-asset-gst-plugin";
|
||||
version = "0.1.0";
|
||||
|
||||
# From upstream PR https://github.com/tauri-apps/tauri/pull/14402
|
||||
src = fetchFromGitHub {
|
||||
owner = "aaalloc";
|
||||
repo = "tauri";
|
||||
rev = "bc502b45a6995aab5687ce3e50b3d218ca5ee105";
|
||||
hash = "sha256-H27n2rsqmGbk7ru8K7LhEvvftpz6mxgTow/18SpQn1Q=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-n9CZ92ezRP9i4JpARwLpW4KIo9/6cB481YuG3qN1BKo=";
|
||||
|
||||
cargoBuildFlags = [ "--package tauri-asset-gst-plugin" ];
|
||||
cargoTestFlags = finalAttrs.cargoBuildFlags;
|
||||
|
||||
nativeBuildInputs = [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
gst_all_1.gstreamer
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
mkdir $out/lib/gstreamer-1.0
|
||||
mv $out/lib/*.so $out/lib/gstreamer-1.0/
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "GStreamer plugin to handle the tauri asset:// protocol";
|
||||
homepage = "https://github.com/tauri-apps/tauri/pull/14402";
|
||||
license = [
|
||||
lib.licenses.mit
|
||||
lib.licenses.asl20
|
||||
];
|
||||
maintainers = with lib.maintainers; [ snu ];
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
})
|
||||
@@ -18,6 +18,9 @@ makeSetupHook {
|
||||
propagatedBuildInputs = [
|
||||
cargo
|
||||
cargo-tauri
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
cargo-tauri.gst-plugin
|
||||
];
|
||||
|
||||
substitutions = {
|
||||
@@ -33,6 +36,14 @@ makeSetupHook {
|
||||
}
|
||||
.${kernelName} or (throw "${kernelName} is not supported by cargo-tauri.hook");
|
||||
|
||||
fixupScript = lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
gappsWrapperArgs+=(
|
||||
--prefix WEBKIT_GST_ALLOWED_URI_PROTOCOLS : "asset"
|
||||
# Not picked up automatically by the wrappers from the propagatedBuildInputs.
|
||||
--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "${cargo-tauri.gst-plugin}/lib/gstreamer-1.0/"
|
||||
)
|
||||
'';
|
||||
|
||||
# $targetDir is the path to the build artifacts (i.e., `./target/release`)
|
||||
installScript =
|
||||
{
|
||||
|
||||
@@ -92,10 +92,19 @@ tauriInstallHook() {
|
||||
echo "Finished tauriInstallHook"
|
||||
}
|
||||
|
||||
tauriFixupHook() {
|
||||
# NOTE: This runs as a preFixupPhase and does not replace the original hook.
|
||||
@fixupScript@
|
||||
}
|
||||
|
||||
if [ -z "${dontTauriBuild:-}" ] && [ -z "${buildPhase:-}" ]; then
|
||||
buildPhase=tauriBuildHook
|
||||
fi
|
||||
|
||||
if [ -z "${dontTauriFixup:-}" ] && [ -z "${fixupPhase:-}" ]; then
|
||||
preFixupPhases+=(tauriFixupHook)
|
||||
fi
|
||||
|
||||
if [ -z "${dontTauriInstall:-}" ] && [ -z "${installPhase:-}" ]; then
|
||||
installPhase=tauriInstallHook
|
||||
fi
|
||||
|
||||
@@ -49,6 +49,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
passthru = {
|
||||
# See ./doc/hooks/tauri.section.md
|
||||
hook = callPackage ./hook.nix { cargo-tauri = finalAttrs.finalPackage; };
|
||||
gst-plugin = callPackage ./gst-plugin.nix { };
|
||||
|
||||
tests = {
|
||||
hook = callPackage ./test-app.nix { cargo-tauri = finalAttrs.finalPackage; };
|
||||
|
||||
Reference in New Issue
Block a user