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} + ''); + +}