Replace remarshal with yq (#26)

Remarshal doesn’t seem to be maintained anymore.

It is also affected by upstream bugs like https://github.com/yaml/pyyaml/issues/89 which affects e.g. prometheus-operator CRDs.
This commit is contained in:
Felix Scheinost 2023-06-19 18:14:20 +02:00 committed by GitHub
parent 0456c92538
commit e77a3898de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 36 deletions

View file

@ -6,19 +6,19 @@ with lib; let
self = {
importYAML = path:
importJSON (pkgs.runCommand "yaml-to-json" {} ''
${pkgs.remarshal}/bin/remarshal -i ${path} -if yaml -of json > $out
${pkgs.yq}/bin/yq -c . ${path} > $out
'');
toYAML = config:
builtins.readFile (pkgs.runCommand "to-yaml" {} ''
${pkgs.remarshal}/bin/remarshal -i ${pkgs.writeText "to-json" (builtins.toJSON config)} -if json -of yaml > $out
${pkgs.yq}/bin/yq -y . ${pkgs.writeText "to-json" (builtins.toJSON config)} > $out
'');
toMultiDocumentYaml = name: documents:
pkgs.runCommand name {}
(concatMapStringsSep "\necho --- >> $out\n"
(
d: "${pkgs.remarshal}/bin/remarshal -i ${builtins.toFile "doc" (builtins.toJSON d)} -if json -of yaml >> $out"
d: "${pkgs.yq}/bin/yq -y . ${pkgs.writeText "to-json" (builtins.toJSON config)} >> $out"
)
documents);