Lightpanda: the headless browser designed for AI and automation
attempt fix for aarch64-darwin
Muki Kiboigo0c0b893c21a0
diff --git a/.github/workflows/nix-deps.yml b/.github/workflows/nix-deps.ymlindex ef31c01f4..5ef5105c2 100644--- a/.github/workflows/nix-deps.yml+++ b/.github/workflows/nix-deps.yml@@ -15,10 +15,6 @@ on:# Allows you to run this workflow manually from the Actions tabworkflow_dispatch:- # TODO: remove before merging to main — only here so pushes to this- # branch exercise the workflow while it's being tested.- pull_request:-permissions:contents: writediff --git a/flake.nix b/flake.nixindex 8ae0224fa..05082306c 100644--- a/flake.nix+++ b/flake.nix@@ -65,19 +65,23 @@rustToolchain = fenix.packages.${system}.stable.toolchain;craneLib = (crane.mkLib pkgs).overrideToolchain minimalRustToolchain;- # We need crtbeginS.o for building.+ # We need crtbeginS.o for building on Linux.crtFiles = pkgs.runCommand "crt-files" { } ''mkdir -p $out/libcp -r ${pkgs.gcc.cc}/lib/gcc $out/lib/gcc'';buildDeps =- pkgs: with pkgs; [- gcc- gcc.cc.lib- crtFiles- glibc.dev- ];+ pkgs:+ if pkgs.stdenv.isDarwin then+ [ ]+ else+ (with pkgs; [+ gcc+ gcc.cc.lib+ crtFiles+ glibc.dev+ ]);v8BuildDeps =pkgs: with pkgs; [diff --git a/nix/package.nix b/nix/package.nixindex c2858246d..35d3c32ae 100644--- a/nix/package.nix+++ b/nix/package.nix@@ -29,8 +29,7 @@ let};rustFfiLib = "${rustLib}/lib/liblightpanda_ffi.a";- # Generated by nix/update-zig-deps-hash.sh — rerun it when build.zig.zon- # changes.+ # Generated by nix/update-zig-deps-hash.sh — rerun it when build.zig.zon changes.zigDepsHash = (import ./zig-deps.nix).hash;zigDeps =@@ -53,7 +52,12 @@ letcp -r "$ZIG_GLOBAL_CACHE_DIR/p" "$out"'';- zigTargetTriple = "${stdenv.hostPlatform.parsed.cpu.name}-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.abi.name}";+ # Zig's os tag is "macos", not nixpkgs' "darwin", and Darwin targets carry no abi component.+ zigTargetTriple =+ if stdenv.isDarwin then+ "${stdenv.hostPlatform.parsed.cpu.name}-macos-none"+ else+ "${stdenv.hostPlatform.parsed.cpu.name}-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.abi.name}";mkZigDerivation =extraArgs:@@ -85,7 +89,7 @@ letpname = "lightpanda-snapshot";version = "${version}-nix";- nativeBuildInputs = [ pkgs.patchelf ];+ nativeBuildInputs = lib.optionals stdenv.isLinux [ pkgs.patchelf ];buildPhase = ''runHook preBuild@@ -96,7 +100,10 @@ let-Dprebuilt_v8_path=${v8} \-Dprebuilt_rust_path=${rustFfiLib}- patchelf --set-interpreter "$(cat "$NIX_CC/nix-support/dynamic-linker")" zig-out/bin/lightpanda-snapshot-creator+ ${lib.optionalString stdenv.isLinux ''+ # Zig's ELF binaries don't carry nix's glibc interpreter path by default+ patchelf --set-interpreter "$(cat "$NIX_CC/nix-support/dynamic-linker")" zig-out/bin/lightpanda-snapshot-creator+ ''}./zig-out/bin/lightpanda-snapshot-creator snapshot.binrunHook postBuild@@ -116,7 +123,7 @@ mkZigDerivation {pname = "lightpanda";version = "${version}-nix";- nativeBuildInputs = [ pkgs.autoPatchelfHook ];+ nativeBuildInputs = lib.optionals stdenv.isLinux [ pkgs.autoPatchelfHook ];buildPhase = ''runHook preBuild@@ -143,11 +150,6 @@ mkZigDerivation {runHook postInstall'';- # Lets `nix build .#lightpanda.zigDeps` target just the fixed-output- # derivation that update-zig-deps-hash.sh needs to rebuild, instead of- # building the whole package.- passthru = { inherit zigDeps; };-meta = {description = "Headless browser designed for AI and automation";homepage = "https://lightpanda.io";