zipline: properly built sharp dependency against system libvips

instead of search/replace libvips-cpp.so which does not work anymore
 for old CPUs since sharp 0.34.0 due to
 3fd818c4b5
This commit is contained in:
Jean-Baptiste Giraudeau 2025-06-04 14:29:41 +02:00
parent 3e3afe5174
commit ad0130f577
No known key found for this signature in database
GPG Key ID: 7CEF8C9CC2D9933B
2 changed files with 21 additions and 11 deletions

View File

@ -1,10 +1,13 @@
{ lib, ... }: { lib, pkgs, ... }:
{ {
name = "zipline"; name = "zipline";
meta.maintainers = with lib.maintainers; [ defelo ]; meta.maintainers = with lib.maintainers; [ defelo ];
nodes.machine = { nodes.machine = {
# On x86, testing with a CPU without SSE 4.2 support
# to ensure native libvips is used
virtualisation.qemu.options = lib.mkIf pkgs.stdenv.hostPlatform.isx86 [ "-cpu core2duo" ];
services.zipline = { services.zipline = {
enable = true; enable = true;
settings = { settings = {
@ -38,7 +41,7 @@
import re import re
machine.wait_for_unit("zipline.service") machine.wait_for_unit("zipline.service")
machine.wait_for_open_port(8000) machine.wait_for_open_port(8000, timeout=300)
resp = machine.succeed("curl zipline.local:8000/api/setup -v -X POST -H 'Content-Type: application/json' -d '{\"username\": \"administrator\", \"password\": \"password\"}' 2>&1") resp = machine.succeed("curl zipline.local:8000/api/setup -v -X POST -H 'Content-Type: application/json' -d '{\"username\": \"administrator\", \"password\": \"password\"}' 2>&1")
data = json.loads(resp.splitlines()[-1]) data = json.loads(resp.splitlines()[-1])

View File

@ -12,6 +12,9 @@
versionCheckHook, versionCheckHook,
nix-update-script, nix-update-script,
nixosTests, nixosTests,
node-gyp,
pkg-config,
python3,
}: }:
let let
@ -43,12 +46,19 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-O8RLaKff4Dj/JDeUOyf7GtcFcOu/aOuclyaZmVqVi5s="; hash = "sha256-O8RLaKff4Dj/JDeUOyf7GtcFcOu/aOuclyaZmVqVi5s=";
}; };
buildInputs = [ vips ]; buildInputs = [
openssl
vips
];
nativeBuildInputs = [ nativeBuildInputs = [
pnpm_10.configHook pnpm_10.configHook
nodejs_24 nodejs_24
makeWrapper makeWrapper
# for sharp build:
node-gyp
pkg-config
python3
]; ];
env = environment; env = environment;
@ -56,6 +66,11 @@ stdenv.mkDerivation (finalAttrs: {
buildPhase = '' buildPhase = ''
runHook preBuild runHook preBuild
# Force build of sharp against native libvips (requires running install scripts).
# This is necessary for supporting old CPUs (ie. without SSE 4.2 instruction set).
pnpm config set nodedir ${nodejs_24}
pnpm install --force --offline --frozen-lockfile
pnpm build pnpm build
runHook postBuild runHook postBuild
@ -88,14 +103,6 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall runHook postInstall
''; '';
preFixup = ''
find $out -name libvips-cpp.so.42 -print0 | while read -d $'\0' libvips; do
echo replacing libvips at $libvips
rm $libvips
ln -s ${lib.getLib vips}/lib/libvips-cpp.so.42 $libvips
done
'';
nativeInstallCheckInputs = [ versionCheckHook ]; nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgram = "${placeholder "out"}/bin/ziplinectl"; versionCheckProgram = "${placeholder "out"}/bin/ziplinectl";
versionCheckProgramArg = "--version"; versionCheckProgramArg = "--version";