add PoC base64 functions

This commit is contained in:
Sean Buckley 2024-08-15 19:12:56 -04:00
parent 2e05efff6d
commit eb578f67be
2 changed files with 16 additions and 0 deletions

View file

@ -34,6 +34,7 @@
nixpkgs.legacyPackages.${system}.nixpkgs-fmt);
lib = {
base64 = import lib/base64.nix;
gen-ssh-config = import lib/gen-ssh-config.nix lib;
ssh-keys = import lib/ssh-keys.nix;

15
lib/base64.nix Normal file
View file

@ -0,0 +1,15 @@
{ runCommand }: {
b64decode = input:
builtins.readFile
(runCommand "b64decode" { } ''
base64 -d >$out <${builtins.toFile "input" input}
'');
b64encode = input:
builtins.readFile
(runCommand "b64encode" { } ''
base64 -w0 >$out <${builtins.toFile "input" input}
'');
}