Fork me on GitHub
#babashka
<
2023-08-07
>
DrLjótsson12:08:40

Is there an example babashka project that starts an nrepl server?

borkdude12:08:39

a bb nrepl server or jvm nrepl server?

DrLjótsson12:08:28

Anything that I connect to from Calva and iteratively develop my bb script in 🙂

borkdude12:08:55

I think calva already has a built-in option for babashka, right @U0ETXRFEW?

borkdude12:08:20

anyway if you want to do it manually, just do bb nrepl-server from your project root and then connect from calva on the printed port

DrLjótsson12:08:35

The bb is running on another computer, so I think I need to start it there?

borkdude12:08:44

ah yes, definitely

borkdude12:08:01

also you need to run the nrepl server on an ip where you can connect to

borkdude12:08:21

e.g.: $ bb nrepl-server 0.0.0.0:1337

borkdude12:08:28

and then connect from calva on that port

borkdude16:08:05

A small poll for macOS users: how many of you are still using an intel Mac vs M1/M2? I'll respond with two options that you can give a thumbs up (or both)

borkdude16:08:12

Intel

👍 35
2
borkdude16:08:23

M1/M2 (arm64)

👍 58
2
lukasz16:08:34

(technically both, because I run BB scripts in GH Actions too, and that's Intel)

borkdude16:08:46

The reason I'm asking is that CircleCI is deprecating their Intel Mac runners in October and I'm wondering what to do. If all else fails I could move to Github Actions, but they are likely dealing with the same upstream problem of renting Mac machines not being supported anymore either. I could also try Rosetta2 on an aarch64 machine to compile bb for amd64 that way).

borkdude14:08:19

OK, I think Rosetta2 will be our saviour here. Compiling with native-image x64 via Rosetta2 works without problem and yields an x64 binary. You can try the binary that I compiled on my M1 machine here:

curl -sL \?rlkey\=g7dcec4itddusivyy0l271bdz\&dl\=0 > bb.zip

unzip bb.zip

./bb
Please try this binary if you are on a macOS Intel machine to see if it works for you.

👀 2
borkdude14:08:00

I've tested it on my own Mac Intel laptop and it worked

DrLjótsson22:08:04

How do I refer to a pod that is not available in the pod registry? Specifically, tzzh/mail is not available for aarch64. So I've compiled it and uploaded to my own github repo. I've tried following the guidance on https://github.com/babashka/pod-registry and created my own manifest file in my bb project's directory, i.e., /manifests/tzzh/mail/0.0.2/manifest.edn with the content

{:pod/name tzzh/mail
 :pod/description "Send emails"
 :pod/version "0.0.2"
 :pod/license ""
 :pod/example ""
 :pod/language "go"
 :pod/artifacts
 [{:os/name "Linux.*"
   :os/arch "aarch64"
   :artifact/url "" ;; My own repo
   :artifact/executable "pod-tzzh-mail"}]}
I've also added :pods {tzzh/mail {:version "0.0.2"} to bb.edn. But it doesn't work, (:require [pod.tzzh.mail :as mail]) gives the following exception
----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  Could not find namespace: pod.tzzh.mail.

borkdude22:08:37

Just use the path to your binary in load-pod

borkdude22:08:50

As a string

DrLjótsson22:08:39

Yes, that works but if possible I would like to be able to run the same script on different platforms. That is, not having to hard code the path to the aarch64 pod in my project. So if it’s possible to get this manifest.edn thing to work that would be great.

borkdude09:08:43

It isn't possible yet to publish manifests outside of the registry. I do want to make it possible though, but there's currently some hammock time going on about that

borkdude09:08:17

Perhaps just allowing load-pod to take a manifest map would be possible

DrLjótsson12:08:34

I see! Thank you, I’ll go for the manual loading instead then. Thanks!

borkdude12:08:45

I think making a PR for tzzh/mail could also work, to add aarch64 support, it's relatively easy with golang

borkdude12:08:58

you can check the fswatcher pod how it's done, it's also golang

DrLjótsson12:08:21

I was able to compile my own aarch64 version, on a Raspberry Pi. But yeah, I should submit a pull request for one to be published there