As per Jakub Holý's great
Awesome Babashka: Parse & produce HTML and SQLite
post, you can use the retrogradeorbit/bootleg
pod to get Hickory (HTML to Hiccup parser) in Babashka.
However, if you're on NixOS, you're going to get yelled at when you try to start a REPL:
: bb-playground; bb repl
Downloading pod retrogradeorbit/bootleg (0.1.9)
Successfully installed pod retrogradeorbit/bootleg (0.1.9)
Exception in thread "main" java.io.IOException:
Cannot run program "/home/jmglov/.babashka/pods/repository/retrogradeorbit/bootleg/0.1.9/linux/x86_64/bootleg":
error=2, No such file or directory
This is because of some missing dynamic libraries, as you can see by running:
: bb-playground; ldd ~/.babashka/pods/repository/retrogradeorbit/bootleg/0.1.9/linux/x86_64/bootleg
linux-vdso.so.1 (0x00007ffc07cea000)
libstdc++.so.6 => not found
libpthread.so.0 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libpthread.so.0 (0x00007f2dd7928000)
libdl.so.2 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libdl.so.2 (0x00007f2dd7923000)
libz.so.1 => not found
librt.so.1 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/librt.so.1 (0x00007f2dd791e000)
libc.so.6 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libc.so.6 (0x00007f2dd7734000)
/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/ld-linux-x86-64.so.2 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib64/ld-linux-x86-64.so.2 (0x00007f2dd792f000)
In order to fix this, you'll need to patch the executable to tell it where to find those libs:
: bb-playground; patchelf --replace-needed libstdc++.so.6 \
/nix/store/myw67gkgayf3s2mniij7zwd79lxy8v0k-gcc-12.3.0-lib/lib/libstdc++.so.6 \
~/.babashka/pods/repository/retrogradeorbit/bootleg/0.1.9/linux/x86_64/bootleg
: bb-playground; patchelf --replace-needed libz.so.1 \
/nix/store/8xgb8phqmfn9h971q7dg369h647i1aa0-zlib-1.3/lib/libz.so.1 \
~/.babashka/pods/repository/retrogradeorbit/bootleg/0.1.9/linux/x86_64/bootleg
Now all of the libs resolve:
: bb-playground; ldd ~/.babashka/pods/repository/retrogradeorbit/bootleg/0.1.9/linux/x86_64/bootleg
linux-vdso.so.1 (0x00007ffee892f000)
/nix/store/myw67gkgayf3s2mniij7zwd79lxy8v0k-gcc-12.3.0-lib/lib/libstdc++.so.6 (0x00007f5eee000000)
libpthread.so.0 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libpthread.so.0 (0x00007f5eee3e1000)
libdl.so.2 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libdl.so.2 (0x00007f5eee3dc000)
libz.so.1 => not found
librt.so.1 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/librt.so.1 (0x00007f5eee3d7000)
libc.so.6 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libc.so.6 (0x00007f5eede18000)
libm.so.6 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/libm.so.6 (0x00007f5eee2f5000)
/nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib/ld-linux-x86-64.so.2 => /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/lib64/ld-linux-x86-64.so.2 (0x00007f5eee3e8000)
libgcc_s.so.1 => /nix/store/myw67gkgayf3s2mniij7zwd79lxy8v0k-gcc-12.3.0-lib/lib/libgcc_s.so.1 (0x00007f5eee2d4000)
And you win:
: bb-playground; bb repl
Babashka v1.4.192 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=>