Skip to content

Commit

Permalink
fix(nixery): Discard string context before parsing with fromJSON
Browse files Browse the repository at this point in the history
Discard string context in prepare-image.nix before parsing input read
with readFile with fromJSON. Required for compatibility with nix >2.3.

Change-Id: I3830707e80fd19a700551a15f1a96d2841d0b022
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6696
Reviewed-by: tazjin <[email protected]>
Tested-by: BuildkiteCI
  • Loading branch information
talyz committed Sep 19, 2022
1 parent 2fe7455 commit 05fca8c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions prepare-image/prepare-image.nix
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ let
# Metadata about the symlink layer which is required for serving it.
# Two different hashes are computed for different usages (inclusion
# in manifest vs. content-checking in the layer cache).
symlinkLayerMeta = fromJSON (readFile (runCommand "symlink-layer-meta.json"
symlinkLayerMeta = fromJSON (builtins.unsafeDiscardStringContext (readFile (runCommand "symlink-layer-meta.json"
{
buildInputs = [ coreutils jq openssl ];
} ''
Expand All @@ -164,11 +164,11 @@ let
jq -n -c --arg tarHash $tarHash --arg size $layerSize --arg path ${symlinkLayer} \
'{ size: ($size | tonumber), tarHash: $tarHash, path: $path }' >> $out
''));
'')));

# Final output structure returned to Nixery if the build succeeded
buildOutput = {
runtimeGraph = fromJSON (readFile runtimeGraph);
runtimeGraph = fromJSON (builtins.unsafeDiscardStringContext (readFile runtimeGraph));
symlinkLayer = symlinkLayerMeta;
};

Expand Down

0 comments on commit 05fca8c

Please sign in to comment.