mirror of
https://github.com/TECHNOFAB11/kubenix.git
synced 2025-12-12 16:10:05 +01:00
fixup tests
This commit is contained in:
parent
bf231d19fa
commit
39badb2084
34 changed files with 88 additions and 110 deletions
36
lib/upstreamables.nix
Normal file
36
lib/upstreamables.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ lib, pkgs }:
|
||||
|
||||
with lib;
|
||||
|
||||
let self = {
|
||||
|
||||
importYAML = path: importJSON (pkgs.runCommand "yaml-to-json" { } ''
|
||||
${pkgs.remarshal}/bin/remarshal -i ${path} -if yaml -of json > $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
|
||||
'');
|
||||
|
||||
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"
|
||||
)
|
||||
documents);
|
||||
|
||||
toBase64 = value:
|
||||
builtins.readFile
|
||||
(pkgs.runCommand "value-to-b64" { } "echo -n '${value}' | ${pkgs.coreutils}/bin/base64 -w0 > $out");
|
||||
|
||||
exp = base: exp: foldr (value: acc: acc * base) 1 (range 1 exp);
|
||||
|
||||
octalToDecimal = value: (foldr
|
||||
(char: acc: {
|
||||
i = acc.i + 1;
|
||||
value = acc.value + (toInt char) * (self.exp 8 acc.i);
|
||||
})
|
||||
{ i = 0; value = 0; }
|
||||
(stringToCharacters value)).value;
|
||||
};
|
||||
in self
|
||||
Loading…
Add table
Add a link
Reference in a new issue