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
# references at runtime.
#
# Source: pub.dev `native_imaging` v0.4.0 tarball — same provenance
# as fluffychat-web's pubspec.lock-resolved native_imaging dependency
# (both pin 0.4.0, both fetch from pub.dev). When fluffychat's
# pubspec.lock bumps native_imaging, bump the version + hash here.
# Source: the exact native_imaging derivation that `pkgs.fluffychat-web`
# already pulls in via its `pubspecLock` (resolved by nixpkgs's flutter
# pub-cache machinery), reached via `passthru.pubspecLock.dependencySources`.
# 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 +
# toolchain). Runtime closure is only the two produced files —
# 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";
version = "0.4.0";
version = pkgs.fluffychat-web.passthru.pubspecLock.dependencyVersions.native_imaging;
src = pkgs.fetchurl {
url = "https://pub.dev/packages/native_imaging/versions/${version}.tar.gz";
hash = "sha256-ztessYuApDFXjJBo65w+51+N85SR6K2vRxY1usKC1lE=";
};
# pub.dev's `.tar.gz` for a dart package unpacks to the working
# directory (no top-level subdir), unlike a normal source tarball.
sourceRoot = ".";
# The pub-cache derivation that fluffychat-web's flutter build uses.
# Already in the build closure; no `fetchurl` or own hash pin.
src = pkgs.fluffychat-web.passthru.pubspecLock.dependencySources.native_imaging;
nativeBuildInputs = with pkgs; [
emscripten