Watch
1
0
Fork
You've already forked nexus
0
forked from Nexus/nexus

use another avif library that works on aarch64-linux

This commit is contained in:
Henry Hiles 2026-10-17 11:18:23 -04:00
commit 8180338d99
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
12 changed files with 93 additions and 196 deletions

View file

@ -9,7 +9,6 @@ let
];
cmakeVersions = [ "3.22.1" ];
platformVersions = [
"31"
"34"
"36"
];
@ -48,17 +47,7 @@ pkgs.mkShell {
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${ANDROID_HOME}/build-tools/36.0.0/aapt2";
}
// lib.optionalAttrs pkgs.stdenv.isLinux (
let
arch = if pkgs.stdenv.hostPlatform.isAarch64 then "arm64" else "x64";
in
{
LD_LIBRARY_PATH = lib.concatStringsSep ":" [
"./build/native_assets/linux"
"./build/linux/${arch}/debug/bundle/lib"
"./build/linux/${arch}/release/bundle/lib"
(lib.makeLibraryPath [ pkgs.zlib ])
];
}
);
// lib.optionalAttrs pkgs.stdenv.isLinux {
LD_LIBRARY_PATH = "./build/native_assets/linux:${lib.makeLibraryPath [ pkgs.zlib ]}";
};
}

View file

@ -0,0 +1,49 @@
# avif_native's build hook downloads its prebuilt library, which the sandbox
# can't do, so bundle it and point the manifest at the local copy instead
{
stdenv,
fetchurl,
jq,
}:
let
artifacts = {
x86_64-linux = {
arch = "x64";
sha256 = "252b064f8ff4f0f265bc44294d4a7ed703dd7199688942c272dd8aa8d3039d5a";
};
aarch64-linux = {
arch = "arm64";
sha256 = "cdcf17cfd18b9b0f965b72615ddf11246121114577dc570d0bba25964e56c726";
};
};
inherit (artifacts.${stdenv.hostPlatform.system}) arch sha256;
key = "linux-${arch}-decode-dav1d";
in
{ version, src, ... }:
stdenv.mkDerivation {
pname = "avif_native";
inherit version src;
inherit (src) passthru;
nativeBuildInputs = [ jq ];
library = fetchurl {
url = "https://github.com/Zhangw1998/avif_native/releases/download/native-v0.1.0/${key}-libavif_native.so.gz";
inherit sha256;
};
# The hook checksums the library, so it must stay byte-identical
dontFixup = true;
installPhase = ''
runHook preInstall
cp -r . $out
chmod -R u+w $out
gunzip -c $library > $out/native/libavif_native.so
jq '.artifacts["${key}"].path = "libavif_native.so"' \
native/manifest.json > $out/native/manifest.json
runHook postInstall
'';
}

View file

@ -34,6 +34,8 @@ flutter.buildFlutterApplication {
autoPubspecLock = src + "/pubspec.lock";
customSourceBuilders.avif_native = callPackage ./avif_native.nix { };
gitHashes = {
linkify = "sha256-TpMD6+0zyY6i9l+6d8ErnVufmepCv362rCtnbOht/z4=";
fab_m3e = "sha256-5V9m6yY0jimx2gh7lQHYg4HDKQ4Wrl0ATmBhw5DkQMI=";