nix/hive-matrix: reuse fluffychat-web's pub-cache native_imaging source (no parallel pin, #685 mara feedback)

mara on PR #697: "this still puts us in the position of having to update
that dependency in sync with upstream. cant we use the one from the
nixpkgs build directly somehow?"

Drops the parallel `fetchurl` + sha256 pin in `fluffychat-web-imaging`.
Source now comes from
`pkgs.fluffychat-web.passthru.pubspecLock.dependencySources.native_imaging`
— the exact derivation that fluffychat-web's flutter build already pulls
into its pub-cache for the dart-side bindings. Version likewise pulled
from `passthru.pubspecLock.dependencyVersions.native_imaging`.

Result: when nixpkgs bumps `pkgs.fluffychat-web` (and with it the
pubspec.lock-resolved native_imaging version), our build automatically
picks up the matching source. No parallel hash to bump, no risk of drift
between the dart-side bindings and the wasm-side C compile.

Verified the build still works against the pub-cache-sourced derivation
(same Makefile, same emscripten flow):

  $ nix-build test-passthru.nix
  ...
  buildPhase completed in 52 seconds
  $ ls /nix/store/.../fluffychat-web-imaging-0.4.0/
  Imaging.js   (9956 bytes)
  Imaging.wasm (67363 bytes)

Byte-for-byte identical to the previous v2 output, just sourced from
the same store path fluffychat-web itself uses.

Follow-up to argus's v2 🟢 review of #697. No regression on the prior
review feedback — `make -C js` + explicit installPhase paths still in place.
This commit is contained in:
atlas 2026-05-31 11:32:57 +02:00 committed by Mara
commit 1a9d940a4a

View file

@ -41,26 +41,25 @@ let
# emscripten-wrapped C library that fluffychat's main.dart.js # emscripten-wrapped C library that fluffychat's main.dart.js
# references at runtime. # references at runtime.
# #
# Source: pub.dev `native_imaging` v0.4.0 tarball — same provenance # Source: the exact native_imaging derivation that `pkgs.fluffychat-web`
# as fluffychat-web's pubspec.lock-resolved native_imaging dependency # already pulls in via its `pubspecLock` (resolved by nixpkgs's flutter
# (both pin 0.4.0, both fetch from pub.dev). When fluffychat's # pub-cache machinery), reached via `passthru.pubspecLock.dependencySources`.
# pubspec.lock bumps native_imaging, bump the version + hash here. # This means **no parallel hash pin** — when nixpkgs bumps
# `pkgs.fluffychat-web` (and with it the pubspec.lock-resolved
# native_imaging version), our build automatically picks up the
# matching source. Version is also pulled from passthru for the
# derivation's `version` attr so it stays in lockstep.
# #
# Closure cost: `pkgs.emscripten` is ~3.6 GiB build-time (LLVM + # Closure cost: `pkgs.emscripten` is ~3.6 GiB build-time (LLVM +
# toolchain). Runtime closure is only the two produced files — # toolchain). Runtime closure is only the two produced files —
# nothing emscripten-shaped survives into the deployed dist. # nothing emscripten-shaped survives into the deployed dist.
fluffychat-web-imaging = pkgs.stdenv.mkDerivation rec { fluffychat-web-imaging = pkgs.stdenv.mkDerivation {
pname = "fluffychat-web-imaging"; pname = "fluffychat-web-imaging";
version = "0.4.0"; version = pkgs.fluffychat-web.passthru.pubspecLock.dependencyVersions.native_imaging;
src = pkgs.fetchurl { # The pub-cache derivation that fluffychat-web's flutter build uses.
url = "https://pub.dev/packages/native_imaging/versions/${version}.tar.gz"; # Already in the build closure; no `fetchurl` or own hash pin.
hash = "sha256-ztessYuApDFXjJBo65w+51+N85SR6K2vRxY1usKC1lE="; src = pkgs.fluffychat-web.passthru.pubspecLock.dependencySources.native_imaging;
};
# pub.dev's `.tar.gz` for a dart package unpacks to the working
# directory (no top-level subdir), unlike a normal source tarball.
sourceRoot = ".";
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
emscripten emscripten