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.
This commit is contained in:
parent
d64abb978c
commit
14b01120c1
@ -50,25 +50,25 @@ rec {
|
|||||||
};
|
};
|
||||||
in valueType;
|
in valueType;
|
||||||
|
|
||||||
generate = name: value: pkgs.runCommand name {
|
generate = name: value: pkgs.callPackage ({ runCommand, jq }: runCommand name {
|
||||||
nativeBuildInputs = [ pkgs.jq ];
|
nativeBuildInputs = [ jq ];
|
||||||
value = builtins.toJSON value;
|
value = builtins.toJSON value;
|
||||||
passAsFile = [ "value" ];
|
passAsFile = [ "value" ];
|
||||||
} ''
|
} ''
|
||||||
jq . "$valuePath"> $out
|
jq . "$valuePath"> $out
|
||||||
'';
|
'') {};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
yaml = {}: {
|
yaml = {}: {
|
||||||
|
|
||||||
generate = name: value: pkgs.runCommand name {
|
generate = name: value: pkgs.callPackage ({ runCommand, remarshal }: runCommand name {
|
||||||
nativeBuildInputs = [ pkgs.remarshal ];
|
nativeBuildInputs = [ remarshal ];
|
||||||
value = builtins.toJSON value;
|
value = builtins.toJSON value;
|
||||||
passAsFile = [ "value" ];
|
passAsFile = [ "value" ];
|
||||||
} ''
|
} ''
|
||||||
json2yaml "$valuePath" "$out"
|
json2yaml "$valuePath" "$out"
|
||||||
'';
|
'') {};
|
||||||
|
|
||||||
type = with lib.types; let
|
type = with lib.types; let
|
||||||
valueType = nullOr (oneOf [
|
valueType = nullOr (oneOf [
|
||||||
@ -161,13 +161,13 @@ rec {
|
|||||||
};
|
};
|
||||||
in valueType;
|
in valueType;
|
||||||
|
|
||||||
generate = name: value: pkgs.runCommand name {
|
generate = name: value: pkgs.callPackage ({ runCommand, remarshal }: runCommand name {
|
||||||
nativeBuildInputs = [ pkgs.remarshal ];
|
nativeBuildInputs = [ remarshal ];
|
||||||
value = builtins.toJSON value;
|
value = builtins.toJSON value;
|
||||||
passAsFile = [ "value" ];
|
passAsFile = [ "value" ];
|
||||||
} ''
|
} ''
|
||||||
json2toml "$valuePath" "$out"
|
json2toml "$valuePath" "$out"
|
||||||
'';
|
'') {};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user