mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-13 08:30:05 +01:00
feat(lib): add toYAML method
This commit is contained in:
parent
663138ae4c
commit
16647cc5ef
2 changed files with 7 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ let
|
||||||
args = {
|
args = {
|
||||||
inherit pkgs;
|
inherit pkgs;
|
||||||
name = "default";
|
name = "default";
|
||||||
k8s = { inherit loadJSON loadYAML toBase64 octalToDecimal mkValueOrSecretOption; };
|
k8s = { inherit loadJSON loadYAML toYAML toBase64 octalToDecimal mkValueOrSecretOption; };
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
6
lib.nix
6
lib.nix
|
|
@ -26,6 +26,12 @@ rec {
|
||||||
loadYAML = path: loadJSON (pkgs.runCommand "yaml-to-json" {
|
loadYAML = path: loadJSON (pkgs.runCommand "yaml-to-json" {
|
||||||
} "${pkgs.remarshal}/bin/remarshal -i ${path} -if yaml -of json > $out");
|
} "${pkgs.remarshal}/bin/remarshal -i ${path} -if yaml -of json > $out");
|
||||||
|
|
||||||
|
toYAML = config: builtins.readFile (pkgs.runCommand "to-yaml" {
|
||||||
|
buildInputs = [pkgs.remarshal];
|
||||||
|
} ''
|
||||||
|
remarshal -i ${pkgs.writeText "to-json" (builtins.toJSON config)} -if json -of yaml > $out
|
||||||
|
'');
|
||||||
|
|
||||||
toBase64 = value:
|
toBase64 = value:
|
||||||
builtins.readFile
|
builtins.readFile
|
||||||
(pkgs.runCommand "value-to-b64" {} "echo '${value}' | ${pkgs.coreutils}/bin/base64 -w0 > $out");
|
(pkgs.runCommand "value-to-b64" {} "echo '${value}' | ${pkgs.coreutils}/bin/base64 -w0 > $out");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue