Fork me on GitHub

babashka v0.2.13: minor bugfix/enhancement release Thanks @dstephens, @wilkerlucio, @kiraemclean, @tekacs and @eamonn.sullivan for contributing!

🎉 18
Eamonn Sullivan09:03:02

Here's a question: The (probably overly elaborate) I wrote in babashka is working well, and I was thinking I would like to move it to some dedicated hardware. I was thinking of using a Raspberry Pi 4 with a couple of USB SSD disks attached, but am I right in thinking that babashka doesn't yet support that ARM processor? What would be a work-around? I should be able to compile the script into a normal uberjar, right?

Eamonn Sullivan09:03:45

Ah, so it looks like progress, but I should probably wait. Presumably I could just add a deps.edn to my project, specifying the dependencies in the usual way and compile it to a jar, right? The Raspberry supports running jars, as far as I know.


Yes, that is certainly possible. But as you can see in that thread, someone already made some ARM binaries available.


And you can possibly compile it yourself on ARM if you need a more updated one. How many GB of memory do you have on ARM?

Eamonn Sullivan09:03:36

I'm looking at the P4 with 8GB of RAM. Or, rather, I'm going to ask my kids for one for my birthday...


Yeah, 8GB should be ok for compiling bb yourself

Eamonn Sullivan09:03:14

(I have 5 kids, all in their 20s and 30s, so they can afford it...)


You need the 64bit one


Compilation takes around 15-20 minutes on a Raspberry

👌 3
Eamonn Sullivan09:03:03

Yes, I'm pretty sure the P4 (and the P3) are 64-bit CPUs.

Eamonn Sullivan09:03:38

So I gather cross-compiling isn't a thing...


4GB of memory is probably just a bit too low, so make sure: 64bit and 8gb, this will work. No, GraalVM doesn't support cross compilation


Some people also have tried qemu for cross compilation

Eamonn Sullivan09:03:52

:thumbsup: -- Another side project to add to the ever-growing list.


If there was a CI that exposed linux ARM 64 bit then I would distribute the binary from there

Eamonn Sullivan10:03:13

Yeah, AWS EC2 arm-64 instances exists, so technically something like CircleCI should be able to spin one up. I'll google around. I use CircleCI already on one my libs. It would be something to play with until I have an actual Pi to use.


I remember seeing something like 2 shebang lines used in context of babashka, but i can't recall what was it for or where did i see it. For example, u can create self-contained shell scripts which pull their dependencies from the Nix package manager, if u start your script with a "double shebang", like this:

#! /usr/bin/env nix-shell
#! nix-shell -i python3 -p python3 python34Packages.pygobject3 libnotify gobjectIntrospection gdk_pixbuf
I remember there was something similar for babashka:
#!/usr/bin/env bb
#! ... ???



   "exec" "bb" "$0" hello "$@"
(prn *command-line-args*)
./script.clj 1 2 3
("hello" "1" "2" "3")

👍 3
Jakub Holý (HolyJak)17:03:36

I've asked in #clojure but it is rather bb specific. I want to extract all calls to log/warn from cljc code, using bb (to make a dictionary of possible app errors for users). But edn/read does not handle reader conditionals. Tips? Use it anyway and register custom reader for #? that returns the content as a map {:clj.., :cljs...}? 🙏


@holyjak You can do this from babashka using This will give you the code including the whitespace, you can then select from this code and spit out some data. Other than that, #rewrite-clj is a really good library for this too, but doesn't work with babashka. If you want to do this using s-expressions directly, you can also use which accepts a :features option which you can set to #{:cljs} to only get cljs branches


You might also be able to do it using tools.reader directly


If you are going with the JVM I would recommend joining #rewrite-clj and use that tool


I suggested to @lee that we should maybe work on a rewrite-clj command line scripting tool for this purpose, I think that would be really neat


Sounds interesting to me! I’m going to try to get rewrite-clj v1 alpha out the door first, getting close!

🎉 3

@lee If you think that rewrite-clj nodes are serializable, then I think a pod can also work


can you e.g. store a rewrite-clj AST to a file and then read it back?


They aren’t easily yet, but we have an open issue on that.


I think it will also be a bit painful when it comes to zippers, so a separate scripting tool makes sense, I think


@holyjak I forgot about which is exactly made for this use case: find s-expressions that match a certain shape

❤️ 3
Jakub Holý (HolyJak)18:03:01

Is it bb or Clj-only?


You can use it from the JVM or a standalone binary. I would start with the JVM


and if you need to run often, you can make a script

👍 3

it also has a binary


I had a feeling you had made a tool specifically for this purpose, but also couldn't remember it. 🙂 You need to make a new tool that can find a relevant Borkdude tool for your use case.

💯 12
😂 15