Fork me on GitHub
#babashka
<
2023-01-06
>
orestis08:01:27

Awesome with the book @nonrecursive! The one thing that has stopped me from using babashka more is figuring out how to install it on CI (e.g. Github Actions) - I'm sure there's an easy way to do it but I haven't seen it in official documentation...

borkdude08:01:12

Look no further than setup-clojure and use bb: latest https://github.com/DeLaGuardo/setup-clojure

orestis08:01:46

Doh! We already use that 😄

orestis08:01:13

It also uses clj-kondo, ahhh I can drop that from our deps.edn

borkdude08:01:26

Just:

bash < <(curl -s )
will also do. In circleci it requires sudo

orestis08:01:19

I think a quick reference in the docs would go a long way for others too (if you endorse the above-linked setup-clojure) 🙂

lispyclouds08:01:44

I'd second the install script based method too, keeps my stuff ci agnostic 😄 and pretty quick too

borkdude08:01:03

the install script is mentioned in the README of babashka

orestis08:01:07

github actions are more declarative and support caching too

lispyclouds08:01:43

yep, but more often than not im not using actions, reasons like bigger machines etc 😅

orestis08:01:48

@U04V15CAJ sure, the install script is the least common denominator. Interestingly, when I google "github action babashka" I see: • https://github.com/marketplace/actions/babashka-clojurehttps://github.com/marketplace/actions/setup-babashka-a-clojure-babushka-for-the-grey-areas-of-bashhttps://github.com/babashka/babashka/actions So I was more thinking a section in the readme just mentioning github actions (even if it is already just repeating the install script, if you don't want to mention specific github actions).

borkdude09:01:13

Sure, I'll add it

orestis12:01:47

Thank you!

borkdude11:01:18

Another bbin-installable cool tool: console history report https://github.com/ThaddeusJiang/chr

bbin install 
chr

🆒 3
borkdude12:01:23

Is anyone here using babaska on asdf? I have doubts if it install the arm binary on m1. Can anyone verify this?

$ file $(which bb)
/Users/borkdude/dev/babashka/bb: Mach-O 64-bit executable arm64

jdavredbeard14:01:18

jonathandavenport@Jonathans-MacBook-Air ~ % asdf install babashka latest
* Downloading babashka release 1.0.169...
/Users/jonathandavenport/.asdf/plugins/babashka/bin/../lib/utils.bash: line 52: arch: unbound variable
rm: /Users/jonathandavenport/.asdf/installs/babashka/1.0.169/babashka-1.0.169.: No such file or directory
asdf-babashka: Expected /Users/jonathandavenport/.asdf/installs/babashka/1.0.169/bin/bb to be executable.
asdf-babashka: An error ocurred while installing babashka 1.0.169.
jonathandavenport@Jonathans-MacBook-Air ~ %

jdavredbeard14:01:38

Just tried this on my M1

jdavredbeard14:01:55

also hadn't heard of asdf before so thanks 🙂

borkdude14:01:10

This seems a bit broken then ...

pesterhazy14:01:50

% file $(asdf which bb)
/Users/user/.asdf/installs/babashka/1.0.165/bin/bb: Mach-O 64-bit executable arm64

pesterhazy14:01:14

Compare

% file $(which bb)
/Users/user/.asdf/shims/bb: Bourne-Again shell script text executable, ASCII text

pesterhazy14:01:44

asdf installs bash shims for all its binaries

pesterhazy14:01:12

@U04GSQQ6TAR this works for me - not sure what's going on on your machine

👀 2
pesterhazy14:01:12

Does this work for you asdf install nodejs latest?

jdavredbeard14:01:16

yes nodejs installs

pesterhazy14:01:19

@U04V15CAJ I've seen problems in our team, maybe, with machines getting binaries for the wrong platform after updating to a new version of osx

jdavredbeard14:01:56

case "$(uname -m)" in
    aarch64) arch=aarch64 ;;
    x86*) arch=amd64 ;;
  esac

jdavredbeard14:01:14

when I run uname -m I get arm64

pesterhazy14:01:41

I have no idea, however, why this is working for me

pesterhazy14:01:56

I'm on macOS 12.6.1

pesterhazy14:01:29

that might be the relevant difference

pesterhazy14:01:08

can you try which uname?

pesterhazy14:01:43

I get /usr/bin/uname

jdavredbeard14:01:22

yep I get the same result

borkdude14:01:21

Yep, that PR should work

pesterhazy14:01:24

fwiw I also get arm64

borkdude14:01:35

The babashka install script also checks arm64 on macos

borkdude14:01:57

This is why I was suspicious that it wouldn't work on asdf, since I saw they weren't doing this

pesterhazy14:01:58

if that author is unresponsive, we could fork the repo

pesterhazy14:01:29

FWIW I've asked around in my team and most people seem to be properly getting the arm64 binary

borkdude14:01:12

I wonder how that is possible

devn21:01:04

out of curiosity, why run bb from asdf?

devn21:01:34

i use asdf for managing some things where i actually need different versions, but for bb i pretty much treat it like im always running edge

devn21:01:46

and i don’t want the asdf shims to eat any startup time

devn21:01:28

(which can sometimes be rather significant, if you’re running a lot of things)

borkdude21:01:44

from my perspective: I just want packages that people use to install bb to work and not be neglected

devn21:01:18

oh, yeah, i wasn’t saying we shouldn’t make asdf do the right thing

devn21:01:08

i was just curious about bb via asdf in particular given asdf, for me anyway, is a way to manage multiple versions of various things, and for bb i imagine most people treat it like “latest, please”

devn21:01:16

though i may be incorrect in that assumption

pesterhazy20:01:40

We install bb via asdf because we do the same for Java, clojure, node, python, ruby etc

borkdude20:01:40

Is it possible to report this babashka asdf plugin as inactive and maybe propose a more maintained one?

pesterhazy20:01:38

We've already forked at least one plugin, it's fairly straightforward

borkdude20:01:54

but this plugin is included in asdf by default

borkdude20:01:23

there must be a way to report inactive things that are included by default?

pesterhazy20:01:46

wait a minute

pesterhazy20:01:11

looks like we (Pitch) actually forked asdf-babashka to make it work on m1

pesterhazy20:01:36

to be used like this

asdf plugin add babashka 

pesterhazy20:01:07

that explains why we have no problems with it

pesterhazy20:01:22

what makes you say that fredZen's plugin is included in asdf by default?

borkdude20:01:41

I'll add mkarp's fork to the bb README

pesterhazy20:01:09

if you give us a minute, we can fork it properly tomorrow in the pitch github org

pesterhazy20:01:41

then it's easier to keep it updated than on a private repo

borkdude20:01:20

makes sense

pesterhazy14:01:54

so much progress, it's amazing

vlad_poh19:01:35

Hi all I’m on a windows machine with limited rights, 4gb of ram trying to troubleshoot an issue that involves jumping back and forth between SQL management studio and postman. I’d rather be in a repl. i have bb and notepad++ and it is almost ok but running the entire script each run is less than ideal. Tried calva but it was too much for this machine. Does anyone have or know of babashka script that will give me a simple clerk like notebook environment to try?

borkdude20:01:51

@U06GMV0B0 This is a really light solution that works with bb too: https://www.loop-code-recur.io/live-clojure-cookbooks/

vlad_poh00:01:35

Live clojure cookbook Looks interesting but i’m still missing out on the interactivity.

vlad_poh00:01:00

looking at the clerk+bb request but not sure how i’d build it and use it

borkdude08:01:30

Are you looking for a low memory interactive process? VSCode is too heavy with the bb nREPL? Emacs?

yes 1
borkdude11:01:11

What you could also do is start the nREPL server on your low resource machine and then connect to it from a stronger machine

borkdude11:01:28

tailscale works great for making your machine accessible to other machines

vlad_poh17:01:49

tailscale sounds amazing going to try that out right now

borkdude18:01:59

if your machine lives inside your house, you probably don't even need it btw

borkdude18:01:22

just open the nrepl on 0.0.0.0:1337 and then connect to your machine's IP on that port

vlad_poh18:01:45

Ended up using http://enclave.io instead of tailscale. Thanks @U04V15CAJ.

👍 2