summary refs log tree commit diff
path: root/pkgs/pkgs-lib
diff options
context:
space:
mode:
authorBen Wolsieffer <benwolsieffer@gmail.com>2022-06-19 22:46:04 -0400
committerBen Wolsieffer <benwolsieffer@gmail.com>2022-06-19 22:50:01 -0400
commit14b01120c1bafb63a03f51e182dd7821a3714c69 (patch)
treeaeceb3f62c9cf1118579d4b7233f1131106e7884 /pkgs/pkgs-lib
parentd64abb978cc2fa4b88b074a64d1b456183c8db17 (diff)
pkgs-lib: fix JSON, YAML and TOML cross-compilation
Splicing of nativeBuildInputs doesn't work unless callPackage is used, so
the generators were attempting to use host platform tools at build time.
Diffstat (limited to 'pkgs/pkgs-lib')
-rw-r--r--pkgs/pkgs-lib/formats.nix26
1 files changed, 13 insertions, 13 deletions
diff --git a/pkgs/pkgs-lib/formats.nix b/pkgs/pkgs-lib/formats.nix
index fc52128a7e999..cdcbd3663422a 100644
--- a/pkgs/pkgs-lib/formats.nix
+++ b/pkgs/pkgs-lib/formats.nix
@@ -50,25 +50,25 @@ rec {
       };
     in valueType;
 
-    generate = name: value: pkgs.runCommand name {
-      nativeBuildInputs = [ pkgs.jq ];
+    generate = name: value: pkgs.callPackage ({ runCommand, jq }: runCommand name {
+      nativeBuildInputs = [ jq ];
       value = builtins.toJSON value;
       passAsFile = [ "value" ];
     } ''
       jq . "$valuePath"> $out
-    '';
+    '') {};
 
   };
 
   yaml = {}: {
 
-    generate = name: value: pkgs.runCommand name {
-        nativeBuildInputs = [ pkgs.remarshal ];
-        value = builtins.toJSON value;
-        passAsFile = [ "value" ];
-      } ''
-        json2yaml "$valuePath" "$out"
-      '';
+    generate = name: value: pkgs.callPackage ({ runCommand, remarshal }: runCommand name {
+      nativeBuildInputs = [ remarshal ];
+      value = builtins.toJSON value;
+      passAsFile = [ "value" ];
+    } ''
+      json2yaml "$valuePath" "$out"
+    '') {};
 
     type = with lib.types; let
       valueType = nullOr (oneOf [
@@ -161,13 +161,13 @@ rec {
       };
     in valueType;
 
-    generate = name: value: pkgs.runCommand name {
-      nativeBuildInputs = [ pkgs.remarshal ];
+    generate = name: value: pkgs.callPackage ({ runCommand, remarshal }: runCommand name {
+      nativeBuildInputs = [ remarshal ];
       value = builtins.toJSON value;
       passAsFile = [ "value" ];
     } ''
       json2toml "$valuePath" "$out"
-    '';
+    '') {};
 
   };