nixos-config/lib/base64.nix

21 lines
342 B
Nix
Raw Normal View History

2024-11-08 03:59:57 +00:00
{ runCommand }:
{
2024-08-15 23:12:56 +00:00
2024-11-08 03:59:57 +00:00
b64decode =
input:
builtins.readFile (
runCommand "b64decode" { } ''
2024-08-15 23:12:56 +00:00
base64 -d >$out <${builtins.toFile "input" input}
2024-11-08 03:59:57 +00:00
''
);
2024-08-15 23:12:56 +00:00
2024-11-08 03:59:57 +00:00
b64encode =
input:
builtins.readFile (
runCommand "b64encode" { } ''
2024-08-15 23:12:56 +00:00
base64 -w0 >$out <${builtins.toFile "input" input}
2024-11-08 03:59:57 +00:00
''
);
2024-08-15 23:12:56 +00:00
}