From ad0130f5774dc9a30ae4ce1c0c947678fa86e311 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Giraudeau Date: Wed, 4 Jun 2025 14:29:41 +0200 Subject: [PATCH] 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 https://github.com/lovell/sharp/commit/3fd818c4b59b055ce60ebc8938297ad69cc2e1e8 --- nixos/tests/zipline.nix | 7 +++++-- pkgs/by-name/zi/zipline/package.nix | 25 ++++++++++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/nixos/tests/zipline.nix b/nixos/tests/zipline.nix index 023c4484a810..40498db9133f 100644 --- a/nixos/tests/zipline.nix +++ b/nixos/tests/zipline.nix @@ -1,10 +1,13 @@ -{ lib, ... }: +{ lib, pkgs, ... }: { name = "zipline"; meta.maintainers = with lib.maintainers; [ defelo ]; 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 = { enable = true; settings = { @@ -38,7 +41,7 @@ import re 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") data = json.loads(resp.splitlines()[-1]) diff --git a/pkgs/by-name/zi/zipline/package.nix b/pkgs/by-name/zi/zipline/package.nix index 46186f60ea81..9cf1f5508e27 100644 --- a/pkgs/by-name/zi/zipline/package.nix +++ b/pkgs/by-name/zi/zipline/package.nix @@ -12,6 +12,9 @@ versionCheckHook, nix-update-script, nixosTests, + node-gyp, + pkg-config, + python3, }: let @@ -43,12 +46,19 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-O8RLaKff4Dj/JDeUOyf7GtcFcOu/aOuclyaZmVqVi5s="; }; - buildInputs = [ vips ]; + buildInputs = [ + openssl + vips + ]; nativeBuildInputs = [ pnpm_10.configHook nodejs_24 makeWrapper + # for sharp build: + node-gyp + pkg-config + python3 ]; env = environment; @@ -56,6 +66,11 @@ stdenv.mkDerivation (finalAttrs: { buildPhase = '' 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 runHook postBuild @@ -88,14 +103,6 @@ stdenv.mkDerivation (finalAttrs: { 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 ]; versionCheckProgram = "${placeholder "out"}/bin/ziplinectl"; versionCheckProgramArg = "--version";