From eb578f67bef5ea3b190194f9da67844e28dd0bda Mon Sep 17 00:00:00 2001 From: Sean Buckley Date: Thu, 15 Aug 2024 19:12:56 -0400 Subject: [PATCH] add PoC base64 functions --- flake.nix | 1 + lib/base64.nix | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 lib/base64.nix diff --git a/flake.nix b/flake.nix index e1d2db4..59f3744 100644 --- a/flake.nix +++ b/flake.nix @@ -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; diff --git a/lib/base64.nix b/lib/base64.nix new file mode 100644 index 0000000..0ac9803 --- /dev/null +++ b/lib/base64.nix @@ -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} + ''); + +}