2026-09-30 22:03:17 -07:00
|
|
|
# Workspace composition may reevaluate this projection after any graph edit.
|
|
|
|
|
# Only the canonical, source-free value becomes a package compilation input.
|
|
|
|
|
{
|
|
|
|
|
pkgs,
|
|
|
|
|
protocol,
|
|
|
|
|
plan ? null,
|
|
|
|
|
contexts ? null,
|
2026-10-01 01:37:46 -07:00
|
|
|
contextData ? null,
|
2026-09-30 22:03:17 -07:00
|
|
|
packageRevisionId,
|
|
|
|
|
}:
|
|
|
|
|
let
|
|
|
|
|
projected = pkgs.runCommand "camino-package-context.json" { } ''
|
|
|
|
|
${pkgs.nodejs_24}/bin/node ${./package-context.mjs} \
|
|
|
|
|
${protocol}/libexec/quixos-protocol/execution-world.mjs ${plan} \
|
|
|
|
|
${pkgs.lib.escapeShellArg packageRevisionId} > "$out"
|
|
|
|
|
'';
|
|
|
|
|
context =
|
2026-10-01 01:37:46 -07:00
|
|
|
if contextData != null then
|
|
|
|
|
contextData
|
|
|
|
|
else if contexts == null then
|
2026-09-30 22:03:17 -07:00
|
|
|
builtins.fromJSON (builtins.readFile projected)
|
|
|
|
|
else
|
|
|
|
|
(builtins.fromJSON (builtins.readFile contexts)).${packageRevisionId};
|
|
|
|
|
in
|
|
|
|
|
{
|
|
|
|
|
# This is typed semantic data (nominal IDs, types and generated source), never
|
|
|
|
|
# Nix artifact paths. Remove the projection derivation's string context, not
|
|
|
|
|
# any code/toolchain dependency. Those are separate explicit helper arguments.
|
|
|
|
|
buildContract = builtins.toFile "camino-package-contract.json" (
|
|
|
|
|
builtins.unsafeDiscardStringContext (builtins.toJSON context.contract)
|
|
|
|
|
);
|
|
|
|
|
sourceDigest = builtins.unsafeDiscardStringContext context.sourceDigest;
|
|
|
|
|
}
|