Proposed change for cypherstack/flutter_libmwc (hook/build.dart). VERIFIED once on NixOS (trek, 2026-11-01): patch applied to the pub-cache copy of flutter_libmwc d8c5d54, empty .cargo/config.toml, MWC hook outputs deleted, `make build-linux` passed (about 6 min, no "protoc failed"). Control without patch and config failed with "protoc failed: Could not start dynamically linked executable". Not tested on Ubuntu/macOS/Windows. Problem: on NixOS the `protoc` binary bundled in prost-build 0.7 (pulled in by mwc-libp2p-core) cannot run, and the PROTOC variable of the developer's shell never reaches cargo because hooks_runner filters the hook's environment (Flutter 3.47.x). Today a developer needs a .cargo/config.toml with [env] PROTOC. Idea: let the hook hand cargo a protoc found on PATH (PATH is on the allowlist). Falls back to prost's bundled one when no protoc is installed, so nothing changes where it already works. --- a/hook/build.dart +++ b/hook/build.dart @@ final environment = { + if (_findOnPath('protoc') case final protoc?) "PROTOC": protoc, if (code.targetOS == .iOS) @@ +String? _findOnPath(String name) { + final sep = Platform.isWindows ? ';' : ':'; + final exe = Platform.isWindows ? '$name.exe' : name; + for (final dir in (Platform.environment['PATH'] ?? '').split(sep)) { + if (dir.isEmpty) continue; + final f = File('$dir${Platform.pathSeparator}$exe'); + if (f.existsSync()) return f.path; + } + return null; +} Longer term: move mwc-libp2p-core to prost-build >= 0.11, which expects protoc from PATH/PROTOC instead of shipping a generic-Linux binary; then no hook change is needed.