about summary refs log tree commit diff
path: root/tools/nixery/prepare-image
diff options
context:
space:
mode:
authortalyz <kim.lindberger@gmail.com>2022-09-19T09·46+0200
committertalyz <kim.lindberger@gmail.com>2022-09-19T11·28+0000
commit02b6b6c5644022a7e0aa80b71fc9a9586aca1ef3 (patch)
tree2089a9d80f3da60ac62a1a44d5b3814c3c0f448b /tools/nixery/prepare-image
parent28417afbb4d8776501f9ae3ecead5859707488b9 (diff)
fix(nixery): Discard string context before parsing with fromJSON r/4925
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 <tazjin@tvl.su>
Tested-by: BuildkiteCI
Diffstat (limited to 'tools/nixery/prepare-image')
-rw-r--r--tools/nixery/prepare-image/prepare-image.nix6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/nixery/prepare-image/prepare-image.nix b/tools/nixery/prepare-image/prepare-image.nix
index bb88983cf6cb..a48545905e03 100644
--- a/tools/nixery/prepare-image/prepare-image.nix
+++ b/tools/nixery/prepare-image/prepare-image.nix
@@ -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 ];
     } ''
@@ -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;
   };