31 lines
1.1 KiB
Nix
31 lines
1.1 KiB
Nix
# 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,
|
||
|
|
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 =
|
||
|
|
if contexts == null then
|
||
|
|
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;
|
||
|
|
}
|